Skip to content
Prev 350349 / 398506 Next

cbind question, please

On 24/04/15 10:41, Erin Hodgess wrote:
I don't understand how you managed to get *that*.  When I did the 
"obvious" thing --- do.call(cbind,as.list(big.char)) --- I got
(as expected :-) )

      [,1]  [,2]  [,3]
[1,] "dog" "cat" "tree"
do.call(cbind,lapply(big.char,get,envir=.GlobalEnv))

Note:  I had to throw in the specification of "envir" otherwise get() 
got the cat() function from "base" rather than your vector "cat".

Probably not a problem for your real application; shouldn't hurt, but.

Another salutary example of why it's not a good idea to give data sets 
names that are names of R built-ins.

cheers,

Rolf