You are on page 1of 3

In-class Exercise (ICE) 15


This is a preview of the published version of the quiz

Started:
Nov 30 at 11:16a.m.

Quiz Instructions
As long as you are online, your answers will be automatically saved while you complete the exercise.
While you have unlimited attempts to complete this in-class-exercise before the due date, only the grade
of the last submitted attempt will be recorded.

Question 1 2.5 pts

Suppose we have a vector name containing names of 50 students in a class. grade


is another vector containing final marks (i.e., numeric values between 0 and 100) of
those students.

v1<-c(name, grade)

v2<-as.numeric(v1)

v3<-as.character(v2)

is.numeric(v2[ 1]) should return [ Select ]


.

is.numeric(v2[ 100])  should return  [ Select ]


.

is.character(v3[ 1]) should return  [ Select ]


.

is.character(v3[ 100]) should return  [ Select ]


.

Question 2 2.5 pts


Again, suppose we have a vector name containing names of 50 students. grade is
another numeric vector containing final marks of those students.

We run the following code:

dat <- tibble(name, grade)

dat$grade[2] <- as.character(dat$grade[2])

is.numeric(dat$grade)

The output should be

Question 3 2.5 pts

Suppose in your current R session,  you have created a data frame called
my_data_frame. 

Suppose you want to export (i.e., save) my_data_frame into a csv


named my_data.csv in your current working directory. What should be the R code
that you need to execute? 

write_csv(my_data_frame, my_data.csv)

writeCSV(my_data_frame, my_data.csv)

writeCSV(my_data_frame, "my_data.csv")

write_csv(my_data_frame, "my_data.csv")

save_csv(my_data_frame, "my_data.csv")

Question 4 2.5 pts


Suppose vancouver_housing_price.rds is a file saved under your current working directory. You
want to save the dataset in vancouver_housing_price.rds into a csv file and save it
as vancouver_housing_price.csv under the current working directory. Complete the following
code. 


(
("vancouver_housing_price.


"), "vancouver_housing_price.
")

Each blank should be either a name of a function or a file extension (e.g., csv, rds, R
etc.). You can only use readRDS, saveRDS, read_csv, write_csv, csv or rds in each
blank.

No new data to save. Last checked at 11:16am


Submit Quiz

You might also like