I have multiple data frames and need calculate mean and SE per week for each dataframe, and save as csv.
In this case, I know the "for loop" is working because I always get the tempdf for df3. I am having difficulty creating and naming a separate csv for each df (e.g. Curated_df1.csv, Curated_df2.csv, Curated_df3.csv).
library(plyr)
list = list (df1, df2, df3)
for (x in list){
tempdf = ddply (x, c("week"),
N = lenght (variable),
mean = mean (variable),
SD = sd (variable),
SE = sd/ sqrt(N))
tempname = paste ("Curated_", x, ".csv", sep = "")
write.csv (tempdf, tempname, na="")
}