- How can we compute the number of days with sunny/mostly sunny conditions by month and location?
> weather2 <- weather %>%
+ group_by(year, month, AirPtCd) %>%
+ summarize(numSunDay = sum(CloudCover %in% c(0,1,2)), numDays=n() )
> glimpse(weather2)
Observations: 4,381
Variables: 5
Groups: year, month [39]
$ year <dbl> 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014, 2014...
$ month <ord> Jul, Jul, Jul, Jul, Jul, Jul, Jul, Jul, Jul, Jul, Ju...
$ AirPtCd <fct> KAAO, KACY, KAGC, KALB, KAMA, KANJ, KART, KATL, KAVP...
$ numSunDay <int> 25, 18, 9, 6, 16, 11, 11, 3, 9, 22, 15, 22, 3, 16, 9...
$ numDays <int> 30, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, ...