[R] calling a list element from a list name passed to a function

From: Gonšalo Ferraz <gferraz29_at_gmail.com>
Date: Sun, 27 Jan 2008 09:42:38 -0400


Hi,

'true_name' is a list of numerical, matrix, and text items

I do

pass_name <- "true_name"

and pass the name of the list to a function so that the character class variable 'passed_name' contains the name of the list called
'true_name'

Inside the function, how can I get a specified element from the list? For example, if I want to get

true_name$month

How do I get that item with the passed name?

Thank you for any help!

Gonšalo



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. Received on Sun 27 Jan 2008 - 13:45:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 27 Jan 2008 - 14:30:09 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive