Question
I am having some problems with my assignment that is located in RStudio Cloud for my Computer Systems class, and I would appreciate it if
I am having some problems with my assignment that is located in RStudio Cloud for my Computer Systems class, and I would appreciate it if when giving the codes for each question that you give a explanation for how the code is structured, because I keep on getting error messages. Thank you
Exploring Differences between Irish Weather Stations in 2017
First, load the following libraries:
library(dplyr) library(ggploty2) library(aimsir17)
1. Gather the following summary annual information for each weather station, and store in the tibble annual.
> print(annual,n=25) # A tibble: 25 x 4
station
-
1 ATHENRY
-
2 BALLYHAISE
-
3 BELMULLET
-
4 CASEMENT
-
5 CLAREMORRIS
-
6 CORK AIRPORT
-
7 DUBLIN AIRPORT
-
8 DUNSANY
-
9 FINNER
-
10 GURTEEN
-
11 JOHNSTOWNII
-
12 KNOCK AIRPORT
-
13 MACE HEAD
-
14 MALIN HEAD
-
15 MARKREE
-
16 MOORE PARK
-
17 MT DILLON
-
18 MULLINGAR
-
19 NEWPORT
-
20 OAK PARK
-
21 PHOENIX PARK
-
22 ROCHES POINT
-
23 SHANNON AIRPORT
-
24 SherkinIsland
-
25 VALENTIA OBSERVATORY
TotalRain AvrWind AvrTemp
952. 6.32 9.75 1243. 12.0 10.6 705. 9.90 10.2
1204 8.02 9.76 1162. 9.48 10.2 662. 11.0 10.1
810. 7.98 9.90 1222. 10.6 10.3 983. 8.27 10.0 963 8.78 10.5
1343. 9.34 8.97 1114. 14.7 10.9 1147. 15.1 10.3 1182. NaN 9.87 1016. 6.08 10.6
992. 6.81 9.83
952. 6.08 9.66 1752. 9.29 10.5 759. 7.41 10.5 732 NaN 10.6 1013. 12.0 10.9 1069. 8.89 10.9 1072. 12.3 11.3 1598. 9.39 11.3
2. For each observation, add the ranking (highest to lowest), using the R function rank().
> print(annual,n=25) # A tibble: 25 x 8
station
-
1 ATHENRY
-
2 BALLYHAISE
3 BELMULLET 4 CASEMENT 5 CLAREMORRIS 6 CORK AIRPORT 7 DUBLIN AIRPORT 8 DUNSANY 9 FINNER
10 GURTEEN 11 JOHNSTOWNII
TotalRain AvrWind AvrTemp
952. 6.32 9.75 1243. 12.0 10.6 705. 9.90 10.2
1204 8.02 9.76 1162. 9.48 10.2 662. 11.0 10.1
810. 7.98 9.90 1222. 10.6 10.3 983. 8.27 10.0 963 8.78 10.5
Rank_Rain Rank_Wind
Rank_Temp Avr_Rank
18 14.7 23 21.3
6 5 15 15.7 22 14.7 14 10.7 16 15.7 19 19 12 8 17 16.3
9 13.7
1
-
12 KNOCK AIRPORT
-
13 MACE HEAD
-
14 MALIN HEAD
-
15 MARKREE
-
16 MOORE PARK
-
17 MT DILLON
-
18 MULLINGAR
-
19 NEWPORT
-
20 OAK PARK
-
21 PHOENIX PARK
-
22 ROCHES POINT
-
23 SHANNON AIRPORT
-
24 SherkinIsland
-
25 VALENTIA OBSERVATORY
>
1343. 9.34 8.97 3 11 1114. 14.7 10.9 11 2 1147. 15.1 10.3 10 1 1182. NaN 9.87 8 24 1016. 6.08 10.6 14 23
992. 6.81 9.83 16 20
952. 6.08 9.66 19 22 1752. 9.29 10.5 1 12 759. 7.41 10.5 22 18 732 NaN 10.6 23 25 1013. 12.0 10.9 15 4 1069. 8.89 10.9 13 13 1072. 12.3 11.3 12 3 1598. 9.39 11.3 2 10
25 13 4 5.67
13 8 20 17.3 7 14.7
21 19 24 21.7 10 7.67 11 17
8 18.7 3 7.33 5 10.3 2 5.67 1 4.33
3. Find the values observations with the highest and lowest rank.
> target # A tibble: 2 x 8
station
-
1 MULLINGAR
-
2 VALENTIA OBSERVATORY
TotalRain AvrWind AvrTemp Rank_Rain
Rank_Wind Rank_Temp Avr_Rank
22 24 21.7 10 1 4.33
4. Extract the station names from the tibble, make use of the function pull() > target
[1] "MULLINGAR" "VALENTIA OBSERVATORY"
5. Based on the variable target filter the observations tibble so that it contains only those records for the highest and lowest ranked stations.
> my_obs # A tibble: 17,520 x 12
station year month
-
1 MULLINGAR 2017 1
-
2 MULLINGAR 2017 1
-
3 MULLINGAR 2017 1
-
4 MULLINGAR 2017 1
-
5 MULLINGAR 2017 1
-
6 MULLINGAR 2017 1
-
7 MULLINGAR 2017 1
-
8 MULLINGAR 2017 1
-
9 MULLINGAR 2017 1
day hour date
rain temp
rhum msl
90 1021. 92 1021. 90 1021. 90 1022. 92 1022. 92 1022 92 1022. 91 1023. 89 1025.
wdsp wddir3 320 5 320 5 320 5 330 5 320 6 340 6 340 7 340 8 340 6 360
10 MULLINGAR 2017 1 # ... with 17,510 more rows
1 0 2017-01-01 00:00:00 0.2 1 1 2017-01-01 01:00:00 0.1 1 2 2017-01-01 02:00:00 0 1 3 2017-01-01 03:00:00 0 1 4 2017-01-01 04:00:00 0 1 5 2017-01-01 05:00:00 0 1 6 2017-01-01 06:00:00 0 1 7 2017-01-01 07:00:00 0 1 8 2017-01-01 08:00:00 0 1 9 2017-01-01 09:00:00 0
5.2 4.3 3.5 3.1 2.4 1.9 1.8 1.9 1.9 1.8
2
6. Plot the following graph showing the distribution of temperature.
7. Plot the following graph showing the distribution of windspeed
3
8. Plot the following graph showing the distribution of rainfall
9. Generate a summary tibble of monthly statistics for each station.
> print(monthly,n=24) # A tibble: 24 x 5
# Groups: station
station [2]
-
1 MULLINGAR
-
2 MULLINGAR
-
3 MULLINGAR
-
4 MULLINGAR
-
5 MULLINGAR
-
6 MULLINGAR
-
7 MULLINGAR
-
8 MULLINGAR
-
9 MULLINGAR
-
10 MULLINGAR
-
11 MULLINGAR
-
12 MULLINGAR
-
13 VALENTIA OBSERVATORY
-
14 VALENTIA OBSERVATORY
-
15 VALENTIA OBSERVATORY
-
16 VALENTIA OBSERVATORY
-
17 VALENTIA OBSERVATORY
-
18 VALENTIA OBSERVATORY
-
19 VALENTIA OBSERVATORY
-
20 VALENTIA OBSERVATORY
-
21 VALENTIA OBSERVATORY
-
22 VALENTIA OBSERVATORY
-
23 VALENTIA OBSERVATORY
-
24 VALENTIA OBSERVATORY
month Rain
2 75 3 83.8 4 14.2 5 70.7 6 98.1 7 90.4 8 77 9 113.
10 104. 11 78.2 12 106
1 169. 2 139. 3 135. 4 51.4 5 76.3 6 143 7 108. 8 103. 9 204.
10 162. 11 107. 12 199.
AvrWind AvrTemp
6.12 12.1 6.19 13.8 5.23 14.6 5.24 13.9 5.85 12 6.76 11.0 5.26 6.22 6.04 4.94 8.78 8.03 11.6 8.26 10.9 9.36 7.11 9.60 7.83 12.6
10.0 14.1 7.90 14.8 8.57 14.8 9.54 13.4
10.3 12.7 9.25 9.66 11.0 8.26
4
10. Generate the following plot of rainfall for each month.
11. Generate the following plot of temperature for each month.
5
12. Generate the following plot of windspeed for each month.
6
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started