Week 2 – Programming using RStudio – Shuffle Q/A 2

21. A data analyst writes the following code in a script and gets an error. What is wrong with their code?

penguins %>%

filter(flipper_length_mm == 200) %>%

group_by(species) %>%

summarize(mean = mean(body_mass_g)) %>%

  • They are using too many functions.
  • The last line should not have a pipe operator.
  • The first line should have a pipe operator before penguins.
  • They are using the wrong characters for the pipe operator.

22. Fill in the blank: When creating a variable for use in R, your variable name should begin with _____.

  • an operator
  • a letter
  • an underscore
  • a number

23. You want to create a vector with the values 21, 12, 39, in that exact order. After specifying the variable, what R code chunk lets you create the vector?

  • c(39, 12, 21)
  • v(39, 12, 21)
  • v(21, 12, 39)
  • c(21, 12, 39)

24. If you use the mdy() function in R to convert the string “April 10, 2019”, what will return when you run your code?

  • “4.10.19”
  • “4/10/2019”
  • “2019-10-4”
  • “2019-4-10”

25. A data analyst wants to combine values using mathematical operations. What type of operator would they use to do this?

  • Arithmetic
  • Conditional
  • Logical
  • Assignment

26. Which of the following files in R have names that follow widely accepted naming convention rules? Select all that apply.

  • p1+infoonpatients.R
  • patient_data.R
  • patient_details_1.R
  • title*123.R

27. A data analyst wants to create functions, documentation, sample data sets, and code test that they can share and reuse in other projects. What should they create to help them accomplish this?

  • A data frame
  • A tidyverse
  • A data type
  • A package

28. A data analyst needs a system of packages that use a common design philosophy for data manipulation, exploration, and visualization. What set of packages fulfills their need?

  • Base
  • CRAN
  • tidyverse
  • Recommended

Shuffle Q/A 3

29. Which of the following are examples of variable names that can be used in R? Select all that apply.

  • alpha_21
  • alpha21
  • tidyverse
  • Recommended

30. What function is used to create vectors in the R programming language?

  • v()
  • c()
  • vector()
  • combine()

Devendra Kumar

Project Management Apprentice at Google

Leave a Reply