Week 3 – Working with data in R – Shuffle Q/A 3

37. You are working with the penguins dataset and want to understand the year of data collection for all combinations of species, island, and sex. You write the following code:

penguins %>%

drop_na() %>%

group_by(species) %>%

summarize(min = min(year), max = max(year))

When you run the code in the code box, how many different groups are returned by this code chunk?

  • 3
  • 10
  • 2
  • 6

38. You are working with the ToothGrowth dataset. You want to use the glimpse() function to get a quick summary of the dataset. Write the code chunk that will give you this summary.

How many different data types are used for the column data types?

  • 2
  • 3
  • 60
  • 1

39. A data analyst is working with a data frame named customers. It has separate columns for area code (area_code) and phone number (phone_num). The analyst wants to combine the two columns into a single column called phone_number, with the area code and phone number separated by a hyphen. What code chunk lets the analyst create the phone_numbercolumn?

  • unite(customers, “phone_number”, area_code, sep=”-”)
  • unite(customers, “phone_number”, area_code, phone_num, sep=”-”)
  • unite(customers, “phone_number”, area_code, phone_num)
  • unite(customers, area_code, phone_num, sep=”-”)

40. You are compiling an analysis of the average monthly costs for your company. What summary statistic function should you use to calculate the average?

  • mean()
  • max()
  • cor()
  • min()

41. A data analyst is studying weather data. They write the following code chunk:

bias(actual_temp, predicted_temp)

What will this code chunk calculate?

  • The average difference between the actual and predicted values
  • The maximum difference between the actual and predicted values
  • The total average of the values
  • The minimum difference between the actual and predicted values

42. A data analyst is working with a large data frame. It contains so many columns that they don’t all fit on the screen at once. The analyst wants a quick list of all of the column names to get a better idea of what is in their data. What function should they use?

  • str()
  • mutate()
  • head()
  • colnames()

43. A data analyst is using the unite() function to combine two columns into a single column. What does the sep parameter of the unite() function represent?

  • The strings to place between each column
  • The vector of columns to join into the final column
  • The data frame that is the target of the operation
  • The name of the final column formed from the original columns

44. A data analyst is checking a script for one of their peers. They want to learn more about a specific data frame. What function(s) will allow them to see a subset of data values in the data frame? Select all that apply.

  • library()
  • colnames()
  • head()
  • str()

45. A data analyst is working with the penguins dataset. The variable island represents the island on which the sample was collected. The analyst wants to create a data frame that excludes records from the island named “Torgersen”. What code chunk will allow them to create this data frame?

  • penguins %>% filter(island == “Torgersen”)
  • penguins %>% filter(island = “Torgersen”)
  • penguins %>% filter(island <> “Torgersen”)
  • penguins %>% filter(island != “Torgersen”)

Devendra Kumar

Project Management Apprentice at Google

Leave a Reply