R Programming Quizzes

Reading & Writing

Question 1

Which function is the primary base R function for reading a comma-separated values (CSV) file into a data frame?

Question 2

In the read.csv() function, to indicate that the first row of the file contains column names, you set the _____ argument to TRUE.

Your answer here.

Question 3

Select all of the following functions that are commonly used to write an R object (like a data frame) to a file.

Question 4

What is the key difference between saving objects using save() (creating a .RData file) and saveRDS() (creating a .rds file)?

Question 5

To check the current working directory in R, you would use the _____() function.

Your answer here.

Question 6

You have a text file named data.txt where columns are separated by tabs. Which base R function call is most appropriate for reading this file?

Question 7

When using write.csv(my_df, 'output.csv'), which arguments can you use to prevent R from writing row numbers and quotation marks around strings?

Question 8

Which of the following is a popular and modern package for reading Microsoft Excel files (.xls and .xlsx) without external dependencies like Java?

Question 9

To save a single R object named my_model to a file named model.rds for later use, the correct function call is _____.

Your answer here.

End of Quiz

Your final score is: 0 / 0

List of Questions

Question 1: Which function is the primary base R function for reading a comma-separated values (CSV) file into a data frame?

Answers: read.csv().

Question 2: Select all of the following functions that are commonly used to write an R object (like a data frame) to a file.

Answers: write.csv(), saveRDS(), write.table().

Question 3: What is the key difference between saving objects using `save()` (creating a .RData file) and `saveRDS()` (creating a .rds file)?

Answers: `save()` can store multiple R objects, while `saveRDS()` is designed for a single R object..

Question 4: You have a text file named `data.txt` where columns are separated by tabs. Which base R function call is most appropriate for reading this file?

Answers: read.delim("data.txt").

Question 5: When using `write.csv(my_df, 'output.csv')`, which arguments can you use to prevent R from writing row numbers and quotation marks around strings?

Answers: row.names = FALSE, quote = FALSE.

Question 6: Which of the following is a popular and modern package for reading Microsoft Excel files (.xls and .xlsx) without external dependencies like Java?

Answers: readxl.