Reputation: 1
I am new to r and have created multiple csv files that contain 25 columbs and 25 rows. I have 10 functions i want to apply to these csv files, then i want to write each of the results to a new csv file. I have tried searching but can not find a useful method if anyone is able to provide some help or tips. Thanks
Upvotes: 0
Views: 56
Reputation: 5429
This involves a number of different design patterns, typically solved like this in R (based on your rather limited description):
all.your.csv.files <- dir( "some/directory/", full.names=TRUE, pattern="\\.csv$" )
for( csv.file in all.your.cvs.files ) {
x <- read.csv( csv.file )
for( func_i in list.of.your.ten.functions ) {
x <- func_i( x )
}
new.filename <- generate.new.filename()
write.csv( x, new.filename )
}
voila! problem solved.
Upvotes: 1