[R] cbind question, please

David Kienle david.kienle at uni-bayreuth.de
Fri Apr 24 09:32:59 CEST 2015


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   2    5
[2,]   2   3    6
[3,]   3   4    7

But I can't imagine that is the solution you are looking for.

Cheers
David


On 24.04.2015 00: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.  There will be a bunch of variables.
>
> I experimented with "do.call", but all I got was
> 1
> 2
> 3
>
> Any suggestions would be much appreciated.  I still think that do.call
> might be the key, but I'm not sure.
>
> R Version 3-1.3, Windows 7.
>
> Thanks,
> Erin
>
>

-- 
David Kienle

Department of Biogeography
University of Bayreuth

GEO II, Rm 003



More information about the R-help mailing list