I am trying to draw a set of graphs, and save them with sensible names.
This code does work, but is not very elegant. How can I rewrite this so that it only has one list, and doesn't require a variable that is incremented?
data <- read.csv("rotation_data.csv", header = TRUE)
colnames <- list(data$Ethane,data$dichloroethane,data$Butane)
colnames2 <- list("Ethane","dichloroethane","Butane")
i=0
for(col in colnames){
postscript(paste(colnames2[i],".eps")) # create a new file to save to
plot(data$Angle, col)
dev.off() # close the graphics device used to create and write to the file
i <- i+1
}