Question 4: Import the dataset

Import the bike sharing CSV using base R.

bike <- read.csv("bike_sharing_data.csv")

Question 5: Number of observations and variables

Find the number of rows and columns.

dim(bike)
## [1] 17379    13

Question 6: Humidity data type

Check how R stores the humidity variable.

class(bike$humidity)
## [1] "character"

Question 7: Season in row 6251

Retrieve the season value in row 6251.

bike$season[6251]
## [1] 4

Question 8: Winter observations

Count observations for each season and retrieve winter (season 4).

table(bike$season)
## 
##    1    2    3    4 
## 4242 4409 4496 4232
sum(bike$season == 4)
## [1] 4232

Question 10: High wind during winter or spring

Count observations with windspeed of at least 40 during winter (4) or spring (1).

sum(bike$season %in% c(4, 1) & bike$windspeed >= 40)
## [1] 46