Hello All, I am trying to open all files within a folder and create multiple histograms from each file, *and* have it save with the original file name plus some new information. The way I have it set up right now, I keep saving over each new graph. I can turn the history on and see them all, but I want them all to save as unique files as well. Idealy they would be "filename CHN 1mm Length Frequency", "filename CHN 2mm Length Frequency"...and so forth. Any hints? Thanks for your time. Here is what I'm using now:
filenames<-dir("C:/Documents and Settings/tfish/Desktop/R/Untilted Data") for(i in filenames){data<- read.csv(i, header = TRUE, skip = 13, sep = ",") hist(data$X.mm.[data$SPP=="RBT"],breaks=seq(20,350,1),col="blue",main="RBT 1mm Length Frequency",freq=TRUE,xlab="Fork Length (mm)") savePlot(filename = "RBT 1mm Length Frequency",type = c("jpg")) hist(data$X.mm.[data$SPP=="RBT"],breaks=seq(20,350,2),col="blue",main="RBT 2mm Length Frequency",freq=TRUE,xlab="Fork Length (mm)") savePlot(filename = "RBT 2mm Length Frequency",type = c("jpg")) Thanks again for any and all help! -- T Fish [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.