Re: [R] Batch importing data

2012-05-02 Thread jiangxijixzy
Thank you very much. -- View this message in context: http://r.789695.n4.nabble.com/Batch-importing-data-tp4592997p4602378.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/l

Re: [R] Batch importing data

2012-04-27 Thread David Winsemius
On Apr 27, 2012, at 1:30 PM, R. Michael Weylandt wrote: list.files() will give you all the file names in your working directory (you can also give it a pattern argument) then can loop over those with something like: lapply(list.files(), read.table) which will put all your files in a list obje

Re: [R] Batch importing data

2012-04-27 Thread R. Michael Weylandt
list.files() will give you all the file names in your working directory (you can also give it a pattern argument) then can loop over those with something like: lapply(list.files(), read.table) which will put all your files in a list object. This is generally considered much more convenient than t

[R] Batch importing data

2012-04-27 Thread jiangxijixzy
I want to import data from about 2000 text files, and hope to create a data frame to make it easy to quote the data. For example, the files like this Oil_20030801.txt, Oil_20030804.txt, Oil_20030805.txt … Oil_20120427.txt The dates aren’t continuous. I want to create the data frame called “Oil”, li

Re: [R] Batch importing data with respective naming

2009-04-29 Thread Adrián Cortés
By doing peak <- list() you initialize a list and then you are adding the data objects to the list in the for loop.To access each data object just go: peaks[[i]] Where i is in [1,100]. This will return the data object you want. Adrian On Tue, Apr 28, 2009 at 11:23 PM, Taylor Hermes wrote: > It

Re: [R] Batch importing data with respective naming

2009-04-28 Thread Taylor Hermes
It seems that this addition works, but has created just one object called 'peak' with all the data from those 100 files. I'd like each file to have a corresponding object containing the data. Thanks for your help! On Tue, Apr 28, 2009 at 19:43, Zeljko Vrba wrote: > On Tue, Apr 28, 2009 at 07:0

Re: [R] Batch importing data with respective naming

2009-04-28 Thread Zeljko Vrba
On Tue, Apr 28, 2009 at 07:09:04PM -1000, Taylor Hermes wrote: > > I tried the following: > Add this before for(): peak <- list() > for (i in 1:100) { > peak[[i]] <- read.table(paste(i,"--one--hist.txt", sep=""), sep=",", > header=TRUE) > } > _

[R] Batch importing data with respective naming

2009-04-28 Thread Taylor Hermes
I'm trying to import data from 100 text files and create data frames that reflect their numbering. The slow way would be to do the following: peak1 <- read.table("1--peak--hist.txt", sep=",", header=TRUE) peak2 <- read.table("2--peak--hist.txt", sep=",", header=TRUE) peak3 <- read.table("3--peak-