Due Date: October 14, 2022 Total Points: 32
1 The following ten observations, taken during the years 1970-1979, are on October snow cover for Eurasia in units of millions of square kilometers. Follow the instructions and answer the questions by typing the appropriate commands.
Year Snow 1970 6.5 1971 12.0 1972 14.9 1973 10.0 1974 10.7 1975 7.9 1976 21.9 1977 12.5 1978 14.5 1979 9.2
Year = c(1970:1979)
Snow = c(6.5, 12, 14.9, 10, 10.7, 7.9, 21.9, 12.5, 14.5, 9.2)
Oct.Snow = data.frame(Year, Snow)
mean(Oct.Snow$Snow)
## [1] 12.01
median(Oct.Snow$Snow)
## [1] 11.35
sd(Oct.Snow$Snow)
## [1] 4.390761
length(which(Oct.Snow$Snow > 10))
## [1] 6
2 The data vector rivers contains the lengths (miles) of 141 major rivers in North America.
length(which(rivers < 500))/length(rivers)
## [1] 0.5815603
length(which(rivers < mean(rivers)))/length(rivers)
## [1] 0.6666667
quantile(sort(rivers), probs = 0.75)
## 75%
## 680
IQR(rivers)
## [1] 370
3 The dataset hflights from the hflights package contains all 227,496 flights that departed Houston in 2011. Using the functions in the dplyr package
Create a data frame from hflights containing only those flights that departed on September 11th of that year. (4)
How many flights departed on that day? (2)
Create a data frame with the first column being the tail number and the second being the number of departures from Houston the plane made that year sorted by most to least number of flights. (4)
4 Using the tornado data set (Canvas - Tornadoes.txt) create a data frame with the year in the first column and the total number of tornadoes in Kansas by year in the second column. (6)