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 yo
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
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 sugge
f Of Erin
Hodgess
> Sent: 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
>
G'day Erin,
On Thu, 23 Apr 2015 20:51:18 -0400
Erin Hodgess 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 so much.
So I g
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 wrote:
> Hello!
: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
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 e
ot;4", "5", "6", "7", "dog",
"cat", "tree"), .Dim = 3:4, .Dimnames = list(NULL, c("dog", "cat",
"tree", "big.char")))
John Kane
Kingston ON Canada
> -Original Message-
> From: eri
tructure(c("1", "2", "3", "2", "3", "4", "5", "6", "7", "dog",
> "cat", "tree"), .Dim = 3:4, .Dimnames = list(NULL, c("dog", "cat",
> "t
On Apr 23, 2015, at 5:41 PM, 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
: 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
These are great! Thank you!
On Thu, Apr 23, 2015 at 7:14 PM, William Dunlap 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 off creat
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 Bowma
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, 2
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 variabl
16 matches
Mail list logo