This set of R Programming Language Multiple Choice Questions & Answers (MCQs) focuses on “dplyr Basics”.
1. The _________ function can be used to select columns of a data frame that you want to focus on.
a) select
b) rename
c) get
d) set
View Answer
Explanation: The select() function allows you to get the few columns you might need.
2. Point out the correct statement?
a) You can also omit variables using the select() function by using the negative sign
b) The arrange() function also allows a special syntax that allows you to specify variable names based on patterns
c) Reordering rows of a data frame is normally easier to do in R
d) The dplyr package provides any “new” functionality to R
View Answer
Explanation: The arrange() function is used to reorder rows of a data frame according to one of the variables/columns.
3. ________ function is similar to the existing subset() function in R but is quite a bit faster.
a) rename
b) filter
c) set
d) subset
View Answer
Explanation: The filter() function is used to extract subsets of rows from a data frame.
4. Columns can be arranged in descending order too by using the special ____ operator.
a) asc()
b) desc()
c) descending()
d) subset
View Answer
Explanation: This will sort the order in decreasing order.
5. Point out the wrong statement?
a) Renaming a variable in a data frame in R is surprisingly hard to do
b) The mutate() function exists to compute transformations of variables in a data frame
c) mute() function, which does the same thing as mutate() but then drops all non-transformed variables
d) The data frame is a key data structure in statistics and in R
View Answer
Explanation: The rename() function is designed to make this process easier.
6. The _________ function is used to generate summary statistics from the data frame within strata defined by a variable.
a) groupby()
b) group()
c) group_by()
d) arrange
View Answer
Explanation: The general operation here is a combination of splitting a data frame into separate pieces defined by a variable or group of variables (group_by()), and then applying a summary function across those subsets (summarize()).
7. The ______ operator allows you to string operations in a left-to-right fashion.
a) %>%>
b) %>%
c) >%>%
d) >>>>%%%
View Answer
Explanation: The pipeline operator %>% is very handy for stringing together multiple dplyr functions in a sequence of operations.
8. There is an SQL interface for relational databases via the _______ package.
a) DIB
b) DB2
c) DBI
d) DIB21
View Answer
Explanation: dplyr can work with other data frame “backends” such as SQL databases.
9. dplyr can be integrated with the ________ package for large fast tables.
a) data.table
b) read.table
c) data.data
d) table.read
View Answer
Explanation: The dplyr package is handy way to both simplify and speed up your data frame management code.
10. Which of the following function is similar to summarize?
a) arrange_by()
b) group()
c) group_by()
d) arrange
View Answer
Explanation: The dplyr package provides a concise set of operations for managing data frames.
Sanfoundry Global Education & Learning Series – R Programming Language.
Here’s the list of Best Books in R Programming Language.
- Check Information Technology Books
- Practice Programming MCQs
- Check R Programming Books
- Apply for Programming Internship