[R] sum multiple csv files
Alejandra Lopez-Galan
alejandra7galan at gmail.com
Mon Jan 15 10:29:05 CET 2018
Hi, I am pretty new to R and I would apreciatte very much your help to
solve my problem. I have 40 csv files that have the same structure, and I
want to merge them into a single data frame.
I already have load and combined all the cvs files into a large list, and I
created two
filenames <- list.files('data',full.names=TRUE)
All_data <- lapply(filenames,function(i){
###read cvs files and add the row and column names to each data frame###
read.csv(i, header=FALSE, sep = "", col.names = col_names, row.names =
row_names)
})
However I would like to sum the rows of cvs files to get a single data
frame (each cvs file has 47 rows and colunms, so the final data frame
should have the same). I could only do it one by one data data frame, but I
was wondering if anyone could give an idea of how to write a function for
this.
Thanks,
Alejandra
[[alternative HTML version deleted]]
More information about the R-help
mailing list