Conceptual question
Answer: True
Conceptual question
Answer:
Conceptual question
Answer: True
Test all four import methods and compare the dimensions of each result.
bike1 <- read.table("bike_sharing_data.csv", sep = ",", header = TRUE)
bike2 <- read.table("bike_sharing_data.txt", sep = "\t", header = TRUE)
bike3 <- read.csv("bike_sharing_data.csv")
bike4 <- read.delim("bike_sharing_data.txt")
dim(bike1); dim(bike2); dim(bike3); dim(bike4)
## [1] 17379 13
## [1] 17379 13
## [1] 17379 13
## [1] 17379 13
Answer: A, B, C, D (all 4 load the entire dataset)
Find the number of rows and columns.
dim(bike3)
## [1] 17379 13
Answer: C (17379, 13)
Check how R classifies the humidity column.
class(bike3$humidity)
## [1] "character"
Answer: B (character)
Use indexing to retrieve the season value in row 6251.
bike3[6251, "season"]
## [1] 4
Answer: D (4)
Count the observations in each season. Season 4 is winter.
table(bike3$season)
##
## 1 2 3 4
## 4242 4409 4496 4232
Answer: C (4232)
Conceptual question
Answer: True
Count the observations with wind speed of 40 or more (the NWS “High” threshold) in winter (4) or spring (1).
high_wind <- subset(bike3, season %in% c(4, 1) & windspeed >= 40)
nrow(high_wind)
## [1] 46
Answer: B (46)