Message-ID: <20150424172317.5fd693ca@bossiaea>
Date: 2015-04-24T09:23:17Z
From: Berwin A Turlach
Subject: cbind question, please
In-Reply-To: <CACxE24nDFQFM3jAypSVJus2DcoULXZN9oOyOAe0NK4Ek6Uuh2A@mail.gmail.com>
G'day Erin,
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'.
HTH.
Cheers,
Berwin