The following objects are masked from 'package:stats':
filter, lag
The following objects are masked from 'package:base':
intersect, setdiff, setequal, union
library(ggdendro)
Warning: package 'ggdendro' was built under R version 4.0.5
library(mapproj)
Warning: package 'mapproj' was built under R version 4.0.5
Loading required package: maps
library(knitr)#make average prcp per yearweather$year <-substr(weather$DATE, 1,4)weather$month <-substr(weather$DATE, 6,7)p <- weather %>%group_by(STATION, NAME, year) %>%summarise(prcp=mean(PRCP),Latitude=mean(LATITUDE), Longitude=mean(LONGITUDE))
`summarise()` regrouping output by 'STATION', 'NAME' (override with `.groups` argument)
m <-na.omit(weather) %>%group_by(STATION, NAME, month) %>%summarise(prcp=mean(PRCP),Latitude=mean(LATITUDE), Longitude=mean(LONGITUDE))
`summarise()` regrouping output by 'STATION', 'NAME' (override with `.groups` argument)
Summary Table
The table below shows the average rainfall per month in inches for each of the 5 weather stations. This table helps the reader understand and compare the average monthly rainfall. The average rainfall per month column is color coded to bring to the readers attention. Rainfall in Hilo stands out as different compared to the other weather stations.
library(kableExtra)
Attaching package: 'kableExtra'
The following object is masked from 'package:dplyr':
group_rows
z<-na.omit(weather)q <- z %>%group_by(NAME) %>%summarise(Count =n(), Avg_Prcp=round(mean(PRCP),4),SD =round(sd(PRCP),4))
`summarise()` ungrouping output (override with `.groups` argument)
q %>%kbl(caption ="Average Monthly Rainfall in Inches") %>%kable_paper("hover", full_width = F) %>%column_spec(3, color =spec_color(q$Avg_Prcp[1:5], end =0.5))
Average Monthly Rainfall in Inches
NAME
Count
Avg_Prcp
SD
HILO INTERNATIONAL AIRPORT 87, HI US
875
10.5192
7.5722
HONOLULU INTERNATIONAL AIRPORT, HI US
980
1.6387
2.5044
KAHULUI AIRPORT, HI US
997
1.5007
2.0399
KULA BRANCH STATION 324.5, HI US
515
2.0285
2.2796
LIHUE WEATHER SERVICE OFFICE AIRPORT 1020.1, HI US
871
3.3243
3.3572
This second table shows monthly rain fall data for each of the weather stations. The color gradient was set to easily identify wetter months from dryer months. Wetter months are greener in color while dryer months are purple in color.
`summarise()` ungrouping output (override with `.groups` argument)
w1 <-t(w[2:13])colnames(w1) <-c("Hilo", "Honolulu", "Kahului", "Kula", "Lihue")x <-as.numeric( w[1,2:13])x1 <-as.numeric( w[2,2:13])x2 <-as.numeric( w[3,2:13])x3 <-as.numeric( w[4,2:13])x4 <-as.numeric( w[5,2:13])w1 %>%kbl(caption ="Monthly Rainfall In Inches") %>%kable_paper("hover", full_width = F) %>%column_spec(2, color =spec_color(x, end =0.8)) %>%column_spec(3, color =spec_color(x1, end =0.8)) %>%column_spec(4, color =spec_color(x2, end =0.8)) %>%column_spec(5, color =spec_color(x3, end =0.8)) %>%column_spec(6, color =spec_color(x4, end =0.8)) %>%scroll_box(width ="700px", height ="700px")