>>>>> Steve Taylor <steve.tay...@aut.ac.nz>
>>>>>     on Thu, 23 Apr 2015 23:32:00 +0000 writes:

    > This works for me...
    > get0 = function(x) get(x,pos=1)
    > sapply(big.char, get0)

Note that  get0() is a _ somewhat important for efficient code _
new function since R 3.2.0
so you'd rather call your functions differently...

    > The extra step seems necessary because without it, get() gets base::cat() 
instead of cat.

    > cheers,
    > Steve

    > -----Original Message-----
    > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf 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

    > 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


    > -- 
    > Erin Hodgess
    > Associate Professor
    > Department of Mathematical and Statistics
    > University of Houston - Downtown
    > mailto: erinm.hodg...@gmail.com

    > [[alternative HTML version deleted]]

    > ______________________________________________
    > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
    > https://stat.ethz.ch/mailman/listinfo/r-help
    > PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
    > and provide commented, minimal, self-contained, reproducible code.

    > ______________________________________________
    > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
    > https://stat.ethz.ch/mailman/listinfo/r-help
    > PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
    > and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to