Question 4

Extract the bike sharing datasets in R

Using read.table with csv

bike1 <- read.table("bike_sharing_data.csv", sep=",", header=TRUE)

Using read.delim

bike4 <- read.delim("bike_sharing_data.txt")

Using read.table with txt

bike2 <- read.table("bike_sharing_data.txt", sep="\t", header=TRUE)

Using read.csv

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

Question 5

Total number of observations and variables for the bike sharing dataset

17379 observations, 13 variables

Question 6

Data type of humidity perceived by R

Numerical

Question 7

Value of season in row 6251

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

The value is 4.

Question 8

Number of observations that have the season as winter

table(bike1$season)
## 
##    1    2    3    4 
## 4242 4409 4496 4232

4 represents winter, so that means there are 4232 observations.

Question 9

In order to add multiple conditions to obtain a subset of a data frame, you can use the logical operations such as & or I between the conditions and within a condition, %in% is used to denote a choice in a vector.

True

Question 10

Amount of observations having “high” wind thread condition or above during witner or spring

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

There are 46 observations.