Assignment
The USDA Food Environment Atlas is a governmental database on local food availability. One particular component is the presence of local agriculture. Farms that have direct to consumer sales and farmers markets are potentially of interest because they provide a source for purchasing food that was produced locally. The data is available herePreview the document.
Part 1
Your assignment is to recreate the heatmap of county level counts of farms with direct sales (shown below). To accomplish this you will need to combine the data sets from those shown in the startup codePreview the document, and apply methods that we have discussed throughout class.Use ggsave() to save the image as a good resolution and sized png file. That is, you determine a resolution and DPI that you feel the plot looks good and allows for some zooming of the image.
usCountyMap.png
Notes:
(1) you like need to join the full names of the states onto the food data before it can then be merged onto the county outlines
(2) the fill mapping on the map is done using a log10() transformation on the counts
(3) You do not need to match the colors of the below image exactly, but something similar should be used
(4) It will take some trial and error to determine the dpi, width and height to get a nice cleaned png file.
Part 2
Create a shiny app that allows the user the choice to pick a variable type (Number of Farmers Markets in 2016 or Number of Farms with Direct sales in 2012) and a State. The shiny app will then display a map of all counties in that state highlighting the number of farmers markets or farms with direct sales. An example of such a map for the state of North Carolina is included below.
usNorthCarolinaMap.png
Submission
For Part 1, submit a .R file and the generated png file of your high resolution image. For part 2, submit a .R file has all the code to build the shiny app and a .RData file that has the fully processed data needed for the shiny app (that is, the shiny app should not do much if any data handling, merging, etc)
Thus, you should submit
A .R file that builds the plot in Part 1
A png file of the plot from Part 1
A .Rdata file that has your processed data needed for the shiny app
A .R that contains the shiny app
Reviews
There are no reviews yet.