a frames in a list
>>
>> df.list <- lapply(seq_len(filenames), read.csv, ...) # '...other...' are
>> options you might want to pass, (like headers=TRUE)
>> names(df.list) <- data_names
>>
>> Now access the data frames by number in the list or by name in
ems to replace is not a multiple of replacement length
>> 4: In N[i] <- read.csv(filenames[i]) :
>> number of items to replace is not a multiple of replacement length
>> 5: In N[i] <- read.csv(filenames[i]) :
>> number of items to replace is not a multiple of replacement
th(filenames)) assign(data_names[i],
>> read.csv(file.path(myDir, filenames[i])))
>>
>>
>> Benjamin Nutter | Biostatistician | Quantitative Health Sciences
>> Cleveland Clinic| 9500 Euclid Ave. | Cleveland, OH 44195 | (216)
>> 445-1365
>&
the list or by name in data_names.
>
> Hope this helps,
>
> Rui Barradas
> Em 25-05-2012 20:08, Nutter, Benjamin escreveu:
> For example:
>
> myDir<- "some file path"
> filenames<- list.files(myDir)
> filenames<- filenames[grep("[.]csv",
On Fri, 25 May 2012, HJ YAN wrote:
Is there any claver way that I do not have to type in all these hundreds
names by hand, maybe using a R package or write some code in some other
languages if it is not too difficult to learn.
I'd put the list of commands in a shell script; e.g.,
# import_f
un...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Kevin Wright
Sent: Friday, May 25, 2012 2:55 PM
To: HJ YAN
Cc: r-help@r-project.org
Subject: Re: [R] Reading a bunch of csv files into R
See ?dir
Assign the value to a vector and loop over the elements of the vector.
Kevin
O
Wright
Sent: Friday, May 25, 2012 2:55 PM
To: HJ YAN
Cc: r-help@r-project.org
Subject: Re: [R] Reading a bunch of csv files into R
See ?dir
Assign the value to a vector and loop over the elements of the vector.
Kevin
On Fri, May 25, 2012 at 12:16 PM, HJ YAN wrote:
> Dear R users
>
>
&
HJ, try something like this:
files <- list.files(pattern = "\\.(csv|CSV)$")
for (i in 1:length(files)) {
temp <- read.csv(files[i], header = FALSE)
... do whatever you want with the contents of temp...
}
Bryan
***
Bryan Hanson
Professor of Chemistry & Biochemistry
See ?dir
Assign the value to a vector and loop over the elements of the vector.
Kevin
On Fri, May 25, 2012 at 12:16 PM, HJ YAN wrote:
> Dear R users
>
>
> I am struggling from a data importing issue:
>
> I have some hundreds of csv files needed to be read into R for futher
> analysis. All thos
9 matches
Mail list logo