Question 1: Business Intelligence definition

Conceptual question

Answer: True

Question 2: Data structures

Conceptual question

Answer:

Question 3: Function calls and arguments

Conceptual question

Answer: True

Question 4: Importing the bike sharing data

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)

Question 5: Observations and variables

Find the number of rows and columns.

dim(bike3)
## [1] 17379    13

Answer: C (17379, 13)

Question 6: Data type of humidity

Check how R classifies the humidity column.

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

Answer: B (character)

Question 7: Season in row 6251

Use indexing to retrieve the season value in row 6251.

bike3[6251, "season"]
## [1] 4

Answer: D (4)

Question 8: Winter observations

Count the observations in each season. Season 4 is winter.

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

Answer: C (4232)

Question 9: Logical operators for subsetting

Conceptual question

Answer: True

Question 10: High wind during winter or spring

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)