[R] how to work on multiple R objects?...

Sean Davis sdavis2 at mail.nih.gov
Tue Jan 3 16:28:26 CET 2006




On 1/3/06 10:24 AM, "Constantine Tsardounis" <costas.magnuse at gmail.com>
wrote:

> Hello, Happy New Year!...
> 
> I am encountering a problem trying to work on the data that I load in R.
> 
> I have loaded to R a series of stock data using
> (csv files are named e.g. IBM.R)
> 
> length.R <- length(list.files(".", pattern=".R")) # the number of
> files with one             #column in the directory "./" ending to
> ".R"
> for (i in 1:length.R) {
> assign(read.csv(list.files(".", pattern=".R")[i],
> read.csv(list.files(".", pattern=".R")[i])))
> }

 mylist <- list()
 for (i in list.files('.',pattern='.R')) {
   mylist[[i]] <- read.csv(i)
 }

Sean




More information about the R-help mailing list