I have a series of csv files in one directory. The csv files share the same format.
I wish to iterate through all of the csv files and plot a graph per csv file.
The (tested) function to plot the graph is as follows:
ggplot(aes(x = Count_norm, y = duration_in_traffic), data = tmp) + geom_point(aes(color = id)) + geom_smooth(aes(color = id), method= "lm", se = F, formula=y ~ poly(x, 3, raw=TRUE))
I have attempted to iterate over the csv files and then plot each by:
setwd("/Users/testdata/")
filenames = dir(pattern="*.csv")
for (i in 1:length(filenames)) { tmp <-read.csv(files[i]) ggplot(aes(x = Count_norm, y = duration_in_traffic), data = tmp) + geom_point(aes(color = id)) + geom_smooth(aes(color = id), method= "lm", se = F, formula=y ~ poly(x, 3, raw=TRUE))}
I have used tmp
as the data source, is this incorrect?