I am iterating through multiple files and storing dataframes in a list. I
want to perform calculations on these dataframes. How would I go about doing
this?
I do:
num_files<- list.files()
list = c()
for(x in num_files)
{
frame = read.table(x)
list = c(list, assign(paste("frame",x),frame))
}
For e
1) You have redefined the command list which creates lists - not a great
idea.
2) See lapply; for example. Try something like:
list.of.df <- lapply(list.of.filenames,read.csv)
list.of.results <- lapply(list.of.df,your.application.function)
Regards,
David
--
View this message in context:
http:
2 matches
Mail list logo