[R] how to index a list with a string?

Peter Alspach Peter.Alspach at plantandfood.co.nz
Thu Aug 27 05:51:51 CEST 2009

Tena koe

Try either

These return subtly (or not so subtly depending on your point of view)
different results.

HTH ....

Peter Alspach

> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of Ning Ma
> Sent: Thursday, 27 August 2009 3:35 p.m.
> To: r-help at r-project.org
> Subject: [R] how to index a list with a string?
> Hi, everybody. I have a list obj L, sth like
> $`aaa`
> [1] "5753"
> if the string 'aaa' is a returned value of a function foo(). 
> what is the right syntax form of L$foo()
> I'm new to R, thanks in advance.
> ______________________________________________
> R-help at r-project.org mailing list
> 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.

More information about the R-help mailing list