ST 308 QUIZ 4-6 QUESTIONS & VERIFIED ANSWERS
What package has functions that can read in SAS data sets (.sas7bdat files)?
Haven
How can you return more than one element from a vector?
Provide an indexing vector with the [] function. For instance, vec[c(3, 5, 10)]
R and RStudio are the same software.
False
Choose the true statement below about lists and vectors.
both are one-dimensional objects
What function creates a data frame?
data.frame()
What is the purpose of the R console?
code is submitted to be evaluated.
Check all of the following that are true about the readxl package and the read_excel()
function.
A specific Excel sheet can be chosen to be read in.
Both .xls and .xlsx files can be read.
What index is the first element of an atomic vector in R given?
1
What function can help you determine your working directory?
getwd()
When we use the term 'base R', we refer to what?
Packages that come with R that automatically load when you open R
, How does R do basic mathematical operations on a vector (or numeric data frame)?
That is, if I have a numeric vector called vec and run the code vec*10, how does R
execute the multiplication?
R applies the operation element-wise.
What does the following syntax for calling a function do?
stats::filter()
Explicitly call the filter function from the stats package.
Suppose we create a list called myList as follows:
myList <- list('first' = iris, 'second'=1:3)
What is one way to access the second element ofmyList and have it be returned as a
vector?
mylist[[2]]
Which of the following correctly sets global chunk options in markdown?
Assume library(knitr) has been run.
opts_chunk$set(echo = FALSE, eval = TRUE, warning = FALSE)
Which statements show how to order the iris dataset decreasing on the Sepal Width
variable? Note: Make sure to run library(dplyr) to be able to use the %>% operator.
iris %>% arrange(desc(Sepal.Width))
iris %>% arrange(-Sepal.Width)
True or False: Local chunk options override global chunk options.
True
What will the following code return?
library(dplyr)
iris %>% select(ends_with("Length"))
Two columns of the iris data frame that end with "Length"
What is the YAML header for?
To define meta-data about your document
In R Markdown, a table of contents can be created for your document by adding the
appropriate option in the YAML header. What symbol(s) or character(s) from the plain
What package has functions that can read in SAS data sets (.sas7bdat files)?
Haven
How can you return more than one element from a vector?
Provide an indexing vector with the [] function. For instance, vec[c(3, 5, 10)]
R and RStudio are the same software.
False
Choose the true statement below about lists and vectors.
both are one-dimensional objects
What function creates a data frame?
data.frame()
What is the purpose of the R console?
code is submitted to be evaluated.
Check all of the following that are true about the readxl package and the read_excel()
function.
A specific Excel sheet can be chosen to be read in.
Both .xls and .xlsx files can be read.
What index is the first element of an atomic vector in R given?
1
What function can help you determine your working directory?
getwd()
When we use the term 'base R', we refer to what?
Packages that come with R that automatically load when you open R
, How does R do basic mathematical operations on a vector (or numeric data frame)?
That is, if I have a numeric vector called vec and run the code vec*10, how does R
execute the multiplication?
R applies the operation element-wise.
What does the following syntax for calling a function do?
stats::filter()
Explicitly call the filter function from the stats package.
Suppose we create a list called myList as follows:
myList <- list('first' = iris, 'second'=1:3)
What is one way to access the second element ofmyList and have it be returned as a
vector?
mylist[[2]]
Which of the following correctly sets global chunk options in markdown?
Assume library(knitr) has been run.
opts_chunk$set(echo = FALSE, eval = TRUE, warning = FALSE)
Which statements show how to order the iris dataset decreasing on the Sepal Width
variable? Note: Make sure to run library(dplyr) to be able to use the %>% operator.
iris %>% arrange(desc(Sepal.Width))
iris %>% arrange(-Sepal.Width)
True or False: Local chunk options override global chunk options.
True
What will the following code return?
library(dplyr)
iris %>% select(ends_with("Length"))
Two columns of the iris data frame that end with "Length"
What is the YAML header for?
To define meta-data about your document
In R Markdown, a table of contents can be created for your document by adding the
appropriate option in the YAML header. What symbol(s) or character(s) from the plain