[R] list entries file into a list

Seth Falcon sfalcon at fhcrc.org
Fri Jan 27 19:51:01 CET 2006


On 27 Jan 2006, avilella at gmail.com wrote:
> But mylist$entrylabel is not working inside the loop.

'$' doesn't evaluate its argument.  You want mylist[[entrylabel]].


> I haven't been able to found my way with R lists, maybe because I'm
> comparing them with perl's hashes.

R lists do have names, but they are not hashes.  You can have
duplicate names in different positions in a list.

You can get at list elements by name using $name and [[name]], but the
argument to $ has to be the actual name, not a var containing the
name.

You can also access elements by number using [[i]]

HTH,

+ seth




More information about the R-help mailing list