Skip to content

Instantly share code, notes, and snippets.

@earino
Created February 13, 2018 14:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save earino/f3571fc7f69f9f4b05d3b687bccc2096 to your computer and use it in GitHub Desktop.
Save earino/f3571fc7f69f9f4b05d3b687bccc2096 to your computer and use it in GitHub Desktop.
Dplyr Questions
1. Which of the following return a subset of the columns of a data frame ?
a) select
b) retrieve
c) get
d) all of the mentioned
2. Point out the correct statement :
a) The data frame is a key data structure in statistics and in R
b) R has an internal implementation of data frames that is likely the one you will use most often
c) There are packages on CRAN that implement data frames via things like relational databases that allow you to operate on very very large data frames
d) All of the mentioned
3. _________ extract a subset of rows from a data frame based on logical conditions.
a) rename
b) filter
c) set
d) subset
4. _________ generate summary statistics of different variables in the data frame, possibly within strata
a) rename
b) summarize
c) set
d) subset
5. Point out the wrong statement :
a) The dplyr package was developed by Hadley Wickham of RStudio
b) The dplyr packageis an optimized and distilled version of his plyr package
c) The dplyr package provides “new” functionality to R
d) None of the mentioned
6. ________ add new variables/columns or transform existing variables
a) mutate
b) add
c) apped
d) arrange
7. The _______ operator is used to connect multiple verb actions together into a pipeline
a) pipe
b) piper
c) start
d) all of the mentioned
Strings and Regexps
8. Which metacharacter matches the end of a string?
A. $
B. ^
C. |
9. What does this expression match?
^[abcd]
A. Any string with an a, b, c, or d in it
B. Any string that begins with a, b, c, or d
C. Any string that begins with a lowercase a, b, c, or d
10. 8. Which of the following regular expressions will match this string:
AaZzXzY
A. x
B. ^[a-z]*$
C. ^\w*$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment