R Programming Questions and Answers – dplyr – 2

This set of R Programming Test 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

Answer: a
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

Answer: a
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

Answer: b
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

Answer: b
Explanation: This will sort the order in decreasing order.

advertisement
advertisement

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

Answer: c
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

Answer: c
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

Answer: b
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

Answer: c
Explanation: dplyr can work with other data frame “backends” such as SQL databases.

advertisement

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

Answer: a
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

Answer: c
Explanation: The dplyr package provides a concise set of operations for managing data frames.

advertisement

Sanfoundry Global Education & Learning Series – R Programming Language.

Here’s the list of Best Books in R Programming Language.

To practice all areas of R Programming for various tests, Here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.