Changes in agricultural land use in Delta

Malcolm and I are working on changes in land use within the Municipality of Delta from 1990 to the present. We are examining two aspects: changes of land use within the ALR; and changes in agricultural/commercial/residential/land use. The work is supported by a grant from KPU and Environment Canada. Work so far:

The image below shows land use within agriculture over time

library(reshape)
cropyearstats <- read.csv("C:/Users/Stephen/Dropbox/delta/cropyearstats.csv")
cropslong <- melt(cropyearstats, id = "Year")
names(cropslong) <- c("Year", "Crop", "Ha")
library(ggplot2)
ggplot(cropslong, aes(x = Year, y = Ha, group = Crop)) + geom_smooth(aes(group = Crop, 
    color = Crop), se = F, size = 2)

plot of chunk unnamed-chunk-1

The data to draw the plot was obtained by Malcolm who used GIS to label each parcel using data from Agri-Foods Canada and Environment Canada. He did this for the agricultural census years 1996, 2001, 2006 and 2011. The lines on the plot are the smoothed results of the area estimates. It is interesting to observe the decline in grass and the increase in berries.

I am also using this example for teaching……so here are my stats programming notes for those who are interested: the original dataset was in 'wide' format, looking like this:

cropyearstats
  Year  Berry Cash.Crop Grass Greenhouse Natural.Habitat Other.Agriculture
1 1996  305.1      3995  2597      18.84           201.6             121.8
2 2001  420.4      4126  1897     210.04           543.1              43.5
3 2007  864.7      3822  1974     178.53           519.4             178.1
4 2011 1210.6      3878  1565     204.25           556.1             158.7
  Unknowns
1   242.42
2   273.04
3    88.31
4   184.11

We need to stack the data by year, so that it is in 'long' format. Hadley Wickham's 'reshape' package has the aptly named 'melt' function so that the melted data looks like this (after changing the names of the columns)

head(cropslong)
  Year      Crop     Ha
1 1996     Berry  305.1
2 2001     Berry  420.4
3 2007     Berry  864.7
4 2011     Berry 1210.6
5 1996 Cash.Crop 3994.8
6 2001 Cash.Crop 4126.3

Then I used Hadley Wickham's ggplot graphics package to get the graph. I could have specified a colour for each crop and I think I'll do that when I have a bit more time. Otherwise ggplot just randomly assigns a colour. Fortunately here it gave grass a green colour but that is just luck.