For each item I want to plot the 5 different prices for both days on the same axis.
I can plot for just one item (i.e "a") but I want to produce multiple graphs and save them automatically.
My actual data set is much larger than the example.
I have been working with this code to try save the graphs, but it is doesn't quite work:
mypath <- file.path("C:","R","SAVEHERE",paste("myplot_", names[i], ".jpg",
sep = ""))
jpg(file=mypath)
mytitle = paste("my title is", names[i])
plot(x,y, main = mytitle)
dev.off()
EDIT: This the code I am using to produce 1 graph.
filter(name== "a")
w2=data.table(w2)
w3 = melt.data.table(data=w2, id.vars=c("Day", "Name"))
wplot = ggplot(w3, aes(x = variable, y = value)) +
geom_point(aes(color=Day)) +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) + ylim(-100, 300)
plot(wplot)
The graph looks like this. I want it to loop through all the names and save graphs that look like the second photo. I hope this information is more helpful than my initial post!
thank you