ST 308 QUIZ QUESTIONS & VERIFIED ANSWERS
What are the two most common row manipulations we do to a data set - Answers - 1.
subset rows
2. reorder rows
you can reorder a dataset by more than variable using the arrange() function from dplyr
- Answers - true
what is the purpose of using the as_tibble() function from the dplyr package - Answers -
1.to convert it an existing data frame into a tibble
what is meant by a logical statement - Answers - A line of code that will return
TRUE/FALSE values
what is the standard "equal to" comparison operator in R - Answers - ==
what family of functions can be used to check the type of R object you have - Answers -
is.
what function in dplyr will subset rows of a tibble - Answers - filter()
what are the two main column manipulations - Answers - 1.subsetting variable
2.renaming columns
Library(dplyr)
iris%>%select(ends_with("Length") - Answers - Two columns of the iris
dataframe:Sepal.Length and Petal.Length
what is the most common type of object used as the first argument to almost every
important function in the tidyverse. - Answers - tibble
how would you rewrite the code with chaining
arrange(filter(select(my_tibble, Var1, Var4) Var 1>20),Var4) - Answers -
my_tibble%>%select(Var1, Var4)%>%filter(Var 1>20)%>%arrange(Var4)
what is the purpose of the mutate() funtion from dplyr - Answers - to add newly created
variables to an already existing tibble
what function allows us to instruct R to create summaries of our data by subgroups -
Answers - group_by
what is the correct output for the code below
if_else(30>20,1 ,10) - Answers - 1
What are the two most common row manipulations we do to a data set - Answers - 1.
subset rows
2. reorder rows
you can reorder a dataset by more than variable using the arrange() function from dplyr
- Answers - true
what is the purpose of using the as_tibble() function from the dplyr package - Answers -
1.to convert it an existing data frame into a tibble
what is meant by a logical statement - Answers - A line of code that will return
TRUE/FALSE values
what is the standard "equal to" comparison operator in R - Answers - ==
what family of functions can be used to check the type of R object you have - Answers -
is.
what function in dplyr will subset rows of a tibble - Answers - filter()
what are the two main column manipulations - Answers - 1.subsetting variable
2.renaming columns
Library(dplyr)
iris%>%select(ends_with("Length") - Answers - Two columns of the iris
dataframe:Sepal.Length and Petal.Length
what is the most common type of object used as the first argument to almost every
important function in the tidyverse. - Answers - tibble
how would you rewrite the code with chaining
arrange(filter(select(my_tibble, Var1, Var4) Var 1>20),Var4) - Answers -
my_tibble%>%select(Var1, Var4)%>%filter(Var 1>20)%>%arrange(Var4)
what is the purpose of the mutate() funtion from dplyr - Answers - to add newly created
variables to an already existing tibble
what function allows us to instruct R to create summaries of our data by subgroups -
Answers - group_by
what is the correct output for the code below
if_else(30>20,1 ,10) - Answers - 1