We are interested in understanding the monthly variation in precipitation in Gainesville, FL. We’ll use some data from the NOAA National Climatic Data Center.
Start by creating a data
directory in the same directory as your homework
scripts and then downloading the data and saving it to this data
directory.
Each row of this data file is a year (from 1961-2013) and each column is a month (January - December).
Rearrange the following program so that it:
Finally, add a comment above the code that describes what it does. The comment
character in R is #
.
plot(monthly_mean_ppt, type = "l", xlab = "Month", ylab = "Mean Precipitation")
monthly_mean_ppt <- colMeans(ppt_data)
ppt_data <- read.csv("./data/gainesville-precip.csv", header = FALSE)
It’s OK if you don’t know exactly how the details of the program work at this point, you just need to figure out the right order based on when variables are defined and when they are used.
[click here for output]