Question 4

Which of the following code would be correct to extract the bike sharing datasets in R?
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")

All answers are correct.

Question 5

What is the total number of observations and variables for the bike sharing dataset?
dim(bike1)
## [1] 17379    13

Question 6

What is the data type of humidity perceived by R?
class(bike1$humidity)
## [1] "character"

Question 7

What is the value of season in row 6251?
bike1[6251, "season"]
## [1] 4

Question 8

How many observations have the season as winter?
sum(bike1$season == 4)
## [1] 4232

Question 10

How many observations have high wind threat condition or above during winter or spring?
bike1_subset <- bike1[bike1$windspeed >= 40 & bike1$season %in% c(1, 4), ]
bike1_subset_num_obs <- nrow(bike1_subset)
print(bike1_subset_num_obs)
## [1] 46