[R] looping through data frames in a workspace

2008-03-04 Thread lucy b
Thanks for helpful replies. Unfortunately, I didn't mention that I want to overwrite the existing data frame with the corrected one using the same name. Here's what I have: ## get names of data frames frames <- names(Filter(function(x) x=="data.frame", sapply(objects(),function(

Re: [R] looping through data frames in a workspace

2008-03-04 Thread Richard Cotton
lucy b wrote: > > I have a workspace containing only data frame objects. I would like to > loop though each one and clean-up text columns in them. How can I have > R loop through the list? I have tried to find an answer in R help but > the closest solution I can find is to make a static list of

Re: [R] looping through data frames in a workspace

2008-03-04 Thread Martin Elff
On Monday 03 March 2008 (23:28:05), lucy b wrote: > I would like to avoid having to type-out a very long list over and > over again. I have tried every variation I could think of similar to: > > for(df in list(noquote(ls( { > >      do stuff with df > >      } > > I know this has to be possible

[R] looping through data frames in a workspace

2008-03-03 Thread lucy b
All, I have a workspace containing only data frame objects. I would like to loop though each one and clean-up text columns in them. How can I have R loop through the list? I have tried to find an answer in R help but the closest solution I can find is to make a static list of data frames, as illus