I need to create a single graph that includes six time plots (year v budget), one for each of the following cities...
city1, city2, city3, city4, city5, and city6.
year (1860-1910) needs to be on the x-axis, and budget (ranging from -$100 to $800) on the y-axis.
I have this code to display the six graphs in the viewer panel:
par(mfrow=c(2,3))
I used this code to produce the graphs, written six times (one for each city)...
plot.default(mydata$budget[mydata$city=="city1"],
mydata$year[mydata$city=="city1"], xlim=c(1860,1910),
ylim=c(-100,800), xlab="City1", ylab="Budget")
However, the issue I'm running into is that the data are not appearing in the graphs produced. In other words, each time I execute the above code, I get a blank graph (with the correct x and y limits) in the viewer panel. How do I get the data to appear in the graph so that there is a dot for each year and a line connecting each dot to the subsequent one?
Here's some of the data...
city aid_sums year budget
1 Boston 0 1860 1.7764366
2 Boston 0 1861 3.5162529
3 Boston 0 1862 1.6834916
4 Boston 0 1863 3.5736373
5 Boston 0 1864 4.4076780
6 Boston 0 1865 5.0411372
7 Boston 0 1866 4.6084619
8 Boston 0 1867 3.6368014
9 Boston 0 1868 2.5624348
10 Boston 0 1869 2.3336493
11 Boston 0 1870 2.3075819