Re: [R] cbind question, please

2015-04-24 Thread Kehl Dániel
:41 To: R help Tárgy: [R] cbind question, please Hello! I have a cbind type question, please: Suppose I have the following: dog - 1:3 cat - 2:4 tree - 5:7 and a character vector big.char - c(dog,cat,tree) I want to end up with a matrix that is a cbind of dog, cat, and tree. This is a toy

Re: [R] cbind question, please

2015-04-24 Thread Rolf Turner
On 24/04/15 10:41, Erin Hodgess wrote: Hello! I have a cbind type question, please: Suppose I have the following: dog - 1:3 cat - 2:4 tree - 5:7 and a character vector big.char - c(dog,cat,tree) I want to end up with a matrix that is a cbind of dog, cat, and tree. This is a toy example.

Re: [R] cbind question, please

2015-04-24 Thread John Kane
-Original Message- From: erinm.hodg...@gmail.com Sent: Thu, 23 Apr 2015 18:41:05 -0400 To: r-h...@stat.math.ethz.ch Subject: [R] cbind question, please Hello! I have a cbind type question, please: Suppose I have the following: dog - 1:3 cat - 2:4 tree - 5:7

Re: [R] cbind question, please

2015-04-24 Thread Martin Maechler
To: R help Subject: [R] cbind question, please Hello! I have a cbind type question, please: Suppose I have the following: dog - 1:3 cat - 2:4 tree - 5:7 and a character vector big.char - c(dog,cat,tree) I want to end up with a matrix

Re: [R] cbind question, please

2015-04-24 Thread Erin Hodgess
, cat, tree, big.char))) John Kane Kingston ON Canada -Original Message- From: erinm.hodg...@gmail.com Sent: Thu, 23 Apr 2015 18:41:05 -0400 To: r-h...@stat.math.ethz.ch Subject: [R] cbind question, please Hello! I have a cbind type question, please: Suppose I have

Re: [R] cbind question, please

2015-04-24 Thread Michael Hannon
Is this what you're looking for? dog - 1:3 bat - 2:4 tree - 5:7 big.char - c(dog,bat,tree) do.call(cbind,lapply(big.char, get)) [,1] [,2] [,3] [1,]125 [2,]236 [3,]347 On Thu, Apr 23, 2015 at 3:41 PM, Erin Hodgess erinm.hodg...@gmail.com wrote:

Re: [R] cbind question, please

2015-04-24 Thread Berwin A Turlach
G'day Erin, On Thu, 23 Apr 2015 20:51:18 -0400 Erin Hodgess erinm.hodg...@gmail.com wrote: Here is the big picture. I have a character vector with all of the names of the variables in it. I want to cbind all of the variables to create a matrix. Doing 3 is straightforward, but many, not

Re: [R] cbind question, please

2015-04-24 Thread Rolf Turner
I am amazed at the number of rather obtuse misunderstandings of the actual nature of Erin's question. The suggestion that Erin should read the intro to R made me smile. Erin is a long time and highly sophisticated user of R; she has no need to read the intro. The person who made that

Re: [R] cbind question, please

2015-04-24 Thread David Kienle
Hello Erin, I think you have explain your goal more detailed. Maybe I am completely lost but as far as I understand now you only need the command cbind: m1 - cbind(dog, dat, tree) dog cat tree [1,] 1 25 [2,] 2 36 [3,] 3 47 But I can't imagine that is the solution

Re: [R] cbind question, please

2015-04-24 Thread William Dunlap
You could do something tricky like do.call(cbind, lapply(big.char, as.name)) dog cat tree [1,] 1 25 [2,] 2 36 [3,] 3 47 but you are usually better off creating these things as part of a list and passing that to do.call(cbind, list). There is a slight danger

Re: [R] cbind question, please

2015-04-24 Thread Clint Bowman
Perhaps: dog - 1:3 cat - 2:4 tree - 5:7 big.char - cbind(dog,cat,tree) big.char dog cat tree [1,] 1 25 [2,] 2 36 [3,] 3 47 colnames(big.char)-c(dog,cat,tree) big.char dog cat tree [1,] 1 25 [2,] 2 36 [3,] 3 47 Clint Bowman

Re: [R] cbind question, please

2015-04-24 Thread Jim Lemon
Hi Erin, Well, if I do this: dog - 1:3 cat - 2:4 tree - 5:7 dct-cbind(dog,cat,tree) I get this: dct dog cat tree [1,] 1 25 [2,] 2 36 [3,] 3 47 If I assume that you want to include the character vector as well: rownames(dct)-big.char dct Jim On Fri, Apr 24, 2015

Re: [R] cbind question, please

2015-04-24 Thread Marc Schwartz
On Apr 23, 2015, at 5:41 PM, Erin Hodgess erinm.hodg...@gmail.com wrote: Hello! I have a cbind type question, please: Suppose I have the following: dog - 1:3 cat - 2:4 tree - 5:7 and a character vector big.char - c(dog,cat,tree) I want to end up with a matrix that is a cbind of

Re: [R] cbind question, please

2015-04-24 Thread Steve Taylor
: Friday, 24 April 2015 10:41a To: R help Subject: [R] cbind question, please Hello! I have a cbind type question, please: Suppose I have the following: dog - 1:3 cat - 2:4 tree - 5:7 and a character vector big.char - c(dog,cat,tree) I want to end up with a matrix that is a cbind of dog, cat

Re: [R] cbind question, please

2015-04-24 Thread Erin Hodgess
These are great! Thank you! On Thu, Apr 23, 2015 at 7:14 PM, William Dunlap wdun...@tibco.com wrote: You could do something tricky like do.call(cbind, lapply(big.char, as.name)) dog cat tree [1,] 1 25 [2,] 2 36 [3,] 3 47 but you are usually better

[R] cbind question, please

2015-04-23 Thread Erin Hodgess
Hello! I have a cbind type question, please: Suppose I have the following: dog - 1:3 cat - 2:4 tree - 5:7 and a character vector big.char - c(dog,cat,tree) I want to end up with a matrix that is a cbind of dog, cat, and tree. This is a toy example. There will be a bunch of variables. I