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

2009-08-29 Thread Uwe Ligges
Peter Alspach wrote: Tena koe Try either L[foo()] or L[[foo()]] These return subtly (or not so subtly depending on your point of view) different results. which is quite important, hence read the documentation. [] returns a list of length 1 (or a vector of length 1 of type list) where [[]]

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

2009-08-26 Thread Ning Ma
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@r-project.org mailing list

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

2009-08-26 Thread David Winsemius
On Aug 26, 2009, at 11:35 PM, Ning Ma wrote: 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() What do you really want to achieve or to learn? Pretty much anything ending in

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

2009-08-26 Thread Peter Alspach
Tena koe Try either L[foo()] or L[[foo()]] These return subtly (or not so subtly depending on your point of view) different results. HTH Peter Alspach -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Ning Ma Sent: