Time for Quiz on Dataframes in R

1.Which function did we use to import a csv file into R?

A. write.csv () B.read.csv () C. import.csv () D. read. File ()

2. What is the core difference between a data frame and a matrix?

A. A Data Frame can have Named rows & columns, but a matrix Cannot

B.A Data Frame can store more data than a matrix

c. A Data Frame Can store a mix of value types, where matrix can only store elements of same type

3. You have the following data frame called df:

You need to subset (filter) the data frame to keep only rows for motorbikes. I.e. the output of your code should be a data frame with only motorbike prices. Which of the following lines of code will accomplish this task?

4. You have three vectors:

v1 <- c (“House in Hollywood”, “House in London”, “House in Japan”)

v2 <- c (2000000, 5000000, 29580000)

v3 <- c (“US Dollars”, “Pounds”, “Yen”)

How would you put them into a data frame with named columns?

5. Your data frame is called shopping. List and it has the following three columns:

        item.name – a character column, e.g.: “Milk”

        category – a character column, e.g.: “For Breakfast”

        price – a numeric column, e.g.: 5.20

       monthly. Budget – a numeric column, e.g.: 10.40

Which of the following qplot calls will produce a scatterplot?

5 1 vote
Article Rating
2 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments