13. You are working with the ToothGrowth dataset. You want to use the skim_without_charts() function to get a comprehensive view of the dataset. Write the code chunk that will give you this view.
What is the average value of the len column?
14. A data analyst is working with a data frame named cars.The analyst notices that all the column names in the data frame are capitalized. What code chunk lets the analyst change all the column names to lowercase?
15. A data analyst is working with the penguins dataset and wants to sort the penguins by body_mass_g from least to greatest. When they run the following code the penguin body mass data is not displayed in the correct order.
penguins %>% arrange(body_mass_g)
What can the data analyst do to fix their code?
- Save the results of arrange() to a variable that gets passed to head()
- Add a minus sign in front of body_mass_g to reverse the order
- Correct the capitalization of arrange() to Arrange()
- Use the print() function instead of the head() function
16. You are working with the penguins dataset. You want to use the summarize() and mean() functions to find the mean value for the variable body_mass_g. You write the following code:
Add the code chunk that lets you find the mean value for the variable body_mass_g.
What is the mean body mass in g for the Adelie species?
17. A data analyst is working with a data frame called zoo_records. They want to create a new column named is_large_animal that signifies if an animal has a weight of more than 199 kilograms. What code chunk lets the analyst create the is_large_animal column?
- zoo_records %>% mutate(is_large_animal = weight > 199)
- zoo_records %>% mutate(weight > 199 = is_large_animal)
- zoo_records %>% mutate(is_large_animal == weight > 199)
- zoo_records %>% mutate(weight > 199 <- is_large_animal)
18. A data analyst is working with a data frame named users. It has separate columns for first name (first_name) and last name (last_name). The analyst wants to combine the two columns into a single column called full_name, with the first name and last name separated by a space. What code chunk lets the analyst create the full_namecolumn?
- unite(users, first_name, last_name, “full_name”, sep = ” “)
- unite(users, “full_name”, first_name, last_name, sep = ” “)
- merge(users, “full_name”, first_name, last_name, sep = ” “)
- unite(users, “full_name”, first_name, last_name, sep = “, “)
19. A data analyst is using statistical measures to get a better understanding of their data. What function can they use to determine how strongly related are two of the variables?
20. A data analyst wants to find out how much the predicted outcome and the actual outcome of their data model differ. What function can they use to quickly measure this?
21. A data analyst creates a data frame with data that has more than 50,000 observations in it. When they print their data frame, it slows down their console. To avoid this, they decide to switch to a tibble. Why would a tibble be more useful in this situation?
- Tibbles won’t overload the console because they automatically only print the first 10 rows of data and as many variables as will fit on the screen
- Tibbles will automatically change the names of variables to make them shorter and easier to read
- Tibbles only include a limited number of data items
- Tibbles will automatically create row names to make the data easier to read