This program is a demo of data wrangling possibilities in R using data from the nearest weather station to my home in Duboce Triangle, SF, CA. The National Oceanic and Atmospheric Administration (NOAA) National Centers For Environmental Information, https://www.ncdc.noaa.gov/cdo-web/datatools allowed local station data to be ordered and downloaded.
The first datasets obtained for station USW00023272 were daily summaries and hourly precipitation for all time.
library(tidyverse)
Loading SF Weather data from September 2017 to earliest record.
library(readr) sfDaily <- read_csv("../data/sf1921to2017GhcnDaily.csv") # Checking if any columns have just NAs. None do. So none are removed. sfDaily <- sfDaily[,colSums(is.na(sfDaily))<nrow(sfDaily)]
# fig.show='hold' ## for side by side plots sfDaily$YEAR <- substring(sfDaily$DATE,1,4) #newDf <- df %>% # group_by(groupVar) %>% # summarize(df = mean(result)) sfYearMax <- sfDaily %>% group_by(sfDaily$YEAR) %>% summarise((sfDaily = mean(TMAX))) plot(sfYearMax, pin = 6,6)
The average $Max = \sum DailyTemp_{Max} / N days$, footnote^[some reference to see].
knitr::kable(tail(sfYearMax, 17))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.