ST 308 QUIZ #2 REVIEW QUESTIONS & VERIFIED
ANSWERS
R Markdown - Answers - A language that uses plain text that gets interpreted by
software (such as a web browser) in order to render formatted text and other output.
3 types of content in R Markdown - Answers - YAML Header
Chunks of R code
Actual text
# (in R Markdown) - Answers - First level header
## (in R Markdown) - Answers - Second level header
Knit - Answers - Produce an R markdown output; Could be an HTML, PDF, or
presentation
echo = TRUE/False - Answers - Hides or shows the code
eval = TRUE/FALSE - Answers - Chooses if the code is evaluated or not
Include = TRUE/FALSE - Answers - Have the code evaluate, not show, and show no
output
Message or Warning = TRUE/FALSE - Answers - Turn on/off displaying messages or
warnings
In-line code - Answers - Snippets of code can be included in the text of an R Markdown
document
How to add a table of contents to an R Markdown document? - Answers - add toc: true
to the YAML header
TRUE or FALSE: When using R Markdown, an object created in a code chunk can be
used in subsequent (later) code chunks. - Answers - True
What is the YAML header for? - Answers - Meta-data about your document
TRUE or FALSE: Global chunk options set the default code chunk settings, but local
options (options on that particular chunk) override global ones. - Answers - TRUE
What package needs to be installed to create a PDF? - Answers - tinytex
, What function must be run to create a PDF in R Markdown? - Answers - install_tinytex(
)
Tidyverse - Answers - The tidyverse is a very well thought-out collection of R packages
for data manipulation, exploratory data analysis, and visualization that share a common
design philosophy.
dplyr - Answers - a package which provides a set of tools for efficiently manipulating
datasets in R. It forms a key part of the tidyverse suite of packages.
as_tibble() - Answers - Convert data frame to one with better printing and no
simplification
filter( ) - Answers - Subset rows
Arrange( ) - Answers - reorder rows
Select ( ) - Answers - subset columns
Rename ( ) - Answers - rename columns
Mutate ( ) - Answers - Add newly created column
group_by() - Answers - group rows by a variable or variables
logical statement - Answers - comparison that resolves as TRUE or FALSE
What is used to show equality in a logical statement? - Answers - ==
is functions - Answers - used to check the type of R object you have
Compound logical operators - Answers - & and |
& - Answers - compound logical operator that means "and"
| - Answers - compound logical operator that means "or"
%in% - Answers - use: x %in% y (y might be a vector) selects all rows where x is a
value found in y
Piping/Chaining - Answers - Using %>% to make using multiple functions in a code
more readable
advantages of using the tidyverse packages over base R functions - Answers - - There
are a lot of examples to reference due to the large community of users
- They have similar syntax that works well together
ANSWERS
R Markdown - Answers - A language that uses plain text that gets interpreted by
software (such as a web browser) in order to render formatted text and other output.
3 types of content in R Markdown - Answers - YAML Header
Chunks of R code
Actual text
# (in R Markdown) - Answers - First level header
## (in R Markdown) - Answers - Second level header
Knit - Answers - Produce an R markdown output; Could be an HTML, PDF, or
presentation
echo = TRUE/False - Answers - Hides or shows the code
eval = TRUE/FALSE - Answers - Chooses if the code is evaluated or not
Include = TRUE/FALSE - Answers - Have the code evaluate, not show, and show no
output
Message or Warning = TRUE/FALSE - Answers - Turn on/off displaying messages or
warnings
In-line code - Answers - Snippets of code can be included in the text of an R Markdown
document
How to add a table of contents to an R Markdown document? - Answers - add toc: true
to the YAML header
TRUE or FALSE: When using R Markdown, an object created in a code chunk can be
used in subsequent (later) code chunks. - Answers - True
What is the YAML header for? - Answers - Meta-data about your document
TRUE or FALSE: Global chunk options set the default code chunk settings, but local
options (options on that particular chunk) override global ones. - Answers - TRUE
What package needs to be installed to create a PDF? - Answers - tinytex
, What function must be run to create a PDF in R Markdown? - Answers - install_tinytex(
)
Tidyverse - Answers - The tidyverse is a very well thought-out collection of R packages
for data manipulation, exploratory data analysis, and visualization that share a common
design philosophy.
dplyr - Answers - a package which provides a set of tools for efficiently manipulating
datasets in R. It forms a key part of the tidyverse suite of packages.
as_tibble() - Answers - Convert data frame to one with better printing and no
simplification
filter( ) - Answers - Subset rows
Arrange( ) - Answers - reorder rows
Select ( ) - Answers - subset columns
Rename ( ) - Answers - rename columns
Mutate ( ) - Answers - Add newly created column
group_by() - Answers - group rows by a variable or variables
logical statement - Answers - comparison that resolves as TRUE or FALSE
What is used to show equality in a logical statement? - Answers - ==
is functions - Answers - used to check the type of R object you have
Compound logical operators - Answers - & and |
& - Answers - compound logical operator that means "and"
| - Answers - compound logical operator that means "or"
%in% - Answers - use: x %in% y (y might be a vector) selects all rows where x is a
value found in y
Piping/Chaining - Answers - Using %>% to make using multiple functions in a code
more readable
advantages of using the tidyverse packages over base R functions - Answers - - There
are a lot of examples to reference due to the large community of users
- They have similar syntax that works well together