[R] cbind question, please
Berwin A Turlach
Berwin.Turlach at gmail.com
Fri Apr 24 11:23:17 CEST 2015
On Thu, 23 Apr 2015 20:51:18 -0400
Erin Hodgess <erinm.hodgess at 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 so much.
So I guess you want something like:
R> do.call(cbind, sapply(big.char, as.name))
dog cat tree
[1,] 1 2 5
[2,] 2 3 6
[3,] 3 4 7
Which does not seem to have the problem of confusing the numeric vector
`cat' with the function 'cat'.
More information about the R-help