Re: [R] how to iterate through a list using ls

2008-11-01 Thread Gabor Grothendieck
Its a FAQ: http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-turn-a-string-into-a-variable_003f On Sat, Nov 1, 2008 at 7:54 PM, Lo, Ken <[EMAIL PROTECTED]> wrote: > Hi all, > > I know this is an idiotic question, but I am trying to iterate through a > list of data.frame using ls (I have name

Re: [R] how to iterate through a list using ls

2008-11-01 Thread Erik Iverson
See ?get However, it sounds like you might look at storing your data.frames in an object of class "list". Then you can do things like: alist <- list(df1 = data.frame(a = 1:10, b = 2:11), df2 = data.frame(a = 2:100, b = 3:101)) lapply(alist, summary) If you wrote your own function to do t

Re: [R] how to iterate through a list using ls

2008-11-01 Thread Sarah Goslee
See ?get And you'll probably also want ?assign On Sat, Nov 1, 2008 at 7:54 PM, Lo, Ken <[EMAIL PROTECTED]> wrote: > Hi all, > > I know this is an idiotic question, but I am trying to iterate through a > list of data.frame using ls (I have named the data frames in a way that > lets me subset them w

[R] how to iterate through a list using ls

2008-11-01 Thread Lo, Ken
Hi all, I know this is an idiotic question, but I am trying to iterate through a list of data.frame using ls (I have named the data frames in a way that lets me subset them with ls(pattern="test", for example). But ls returns a character vector. How to I refer to the data frames by their names i