[R] how to make list() return a list of *named* elements

Hans Ekbrand hans.ekbrand at sociology.gu.se
Mon Oct 4 15:01:33 CEST 2010


On Mon, Oct 04, 2010 at 07:51:10PM +0800, Berwin A Turlach wrote:
> R> my.return <- function (vector.of.variable.names) {  
>      sapply(vector.of.variable.names, function(x) get(x))
>    }

Even better :-)

-- 
Hans Ekbrand (http://sociologi.cjb.net) <hans at sociologi.cjb.net>
GPG Fingerprint: 1408 C8D5 1E7D 4C9C C27E 014F 7C2C 872A 7050 614E
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20101004/01b4fe39/attachment.bin>


More information about the R-help mailing list