Module 2 challenge :Data Analysis with R Programming (Google Data Analytics Professional Certificate) Answers 2025
Question 1
Which of the following are valid variable names in R?
✅ value_2
❌ value%2
❌ value(2)
❌ value-2
Explanation:
In R, variable names can include letters, numbers, and underscores (_) but cannot contain special characters (like %, -, or parentheses).
Question 2
Which statements about vectors in R are correct?
✅ All data elements must have the same data type.
✅ Data elements are stored in a sequence.
❌ Data elements are defined using curly braces.
❌ All data must be stored in vectors.
Explanation:
R vectors hold homogeneous (same type) data in a sequence.
They’re defined using c(), not {}.
Not all data in R must be in vectors (you can have lists, data frames, etc.).
Question 3
Which code could return “2020-07-10”?
✅ mdy(“July 10th, 2020”)
✅ ymd(20200710)
❌ myd(2020, July 10)
❌ dmy(“7-10-2020”)
Explanation:
-
mdy()→ month-day-year (valid for “July 10th, 2020”). -
ymd()→ year-month-day (valid for “20200710”). -
myd()is not a valid function in lubridate. -
dmy("7-10-2020")returns October 7, 2020, not July 10.
Question 4
Code: change_1 <- 70 — what kind of operator?
✅ Assignment
❌ Arithmetic
❌ Logical
❌ Relational
Explanation:
The <- operator in R assigns a value (here, 70) to an object (change_1).
Question 5
Best practice for naming functions in R:
✅ Function names should be verbs
❌ Should start with a special character
❌ Should be very long
❌ Should be capitalized
Explanation:
Functions should describe an action (e.g., calculate_mean(), plot_graph()), making them clear and consistent with R style guides.
Question 6
R packages include sample datasets, reusable functions, and documentation.
✅ True
Explanation:
Packages often include datasets, functions, and help documentation (accessible with ?function_name).
Question 7
A system of packages for data manipulation, exploration, and visualization:
✅ tidyverse
❌ Base
❌ Recommended
❌ CRAN
Explanation:
Tidyverse includes packages like dplyr, ggplot2, tidyr, readr, etc.
All share a consistent grammar and design philosophy for modern data analysis.
Question 8
Filter where age = 10 → arrange by height → group by gender
✅
group_by( arrange( filter( people, age == 10 ), height ), gender )
❌ Other options
Explanation:
The question specifies the order:
1️⃣ Filter → 2️⃣ Arrange → 3️⃣ Group.
In nested form, that’s exactly what the correct code does.
🧾 Summary Table
| Q# | ✅ Correct Answer(s) | Key Concept |
|---|---|---|
| 1 | value_2 | Valid R variable naming |
| 2 | 1, 3 | Vector properties |
| 3 | mdy(“July 10th, 2020”), ymd(20200710) | Date parsing functions |
| 4 | Assignment | <- assigns values |
| 5 | Function names should be verbs | Function naming conventions |
| 6 | True | Package contents |
| 7 | tidyverse | Core R ecosystem |
| 8 | group_by(arrange(filter(…))) | Function chaining order |