Reputation: 18875
I have the following structure in a file:
2014 50
2012 60
2016 80
I wish to plot a histogram using the first column as x values, and the second column as y values.
I tried:
data<-read.table(fileinput.txt, header = T)
hist(data[,2])
but it only gives me two bars.
If I want to write this into an R script, how to save the image to a location on the server?
Upvotes: 0
Views: 1029
Reputation: 12875
barplot(dt$obs,dt$year)
Have a look at the other arguments as well.
You can use jpeg
to save it to a file.
Upvotes: 1