R Programming Language Certification Professional Standards & Competencies 3 — Questions and Answers
Question 1: Which practice aligns with ethical data handling standards when working with personal data in R?
- Anonymizing or pseudonymizing identifiers before analysis (Correct answer)
- Storing raw personally identifiable information in public GitHub repositories
- Sharing full datasets with all project collaborators regardless of need
- Logging all user records to console output for debugging
Correct answer: Anonymizing or pseudonymizing identifiers before analysis
Anonymizing PII before analysis complies with privacy regulations and ethical data stewardship principles.
Question 2: What is the purpose of writing unit tests for R functions using the testthat package?
- To automatically verify that functions behave correctly as the codebase evolves (Correct answer)
- To slow down development by requiring extra code for every function
- To replace documentation with executable examples
- To measure the execution speed of each function
Correct answer: To automatically verify that functions behave correctly as the codebase evolves
Unit tests catch regressions early and provide confidence that refactoring or new code does not break existing functionality.
Question 3: A professional R programmer is asked to analyze data they believe may have been collected unethically. What is the appropriate response?
- Raise the concern with supervisors or an ethics review board before proceeding (Correct answer)
- Proceed with the analysis since the data collection is not their responsibility
- Delete the data immediately without consulting anyone
- Use the data but exclude it from the final report
Correct answer: Raise the concern with supervisors or an ethics review board before proceeding
Raising ethical concerns through proper channels ensures accountability and compliance with professional standards.
Question 4: Which approach best supports long-term maintainability of an R analysis project?
- Modular functions with descriptive names, inline comments only where non-obvious, and a clear README (Correct answer)
- A single monolithic script with extensive inline comments explaining every line
- No documentation to keep the project lightweight
- Hard-coding all parameters directly into the analysis script
Correct answer: Modular functions with descriptive names, inline comments only where non-obvious, and a clear README
Modular design, meaningful names, and targeted documentation reduce cognitive load and ease future maintenance.
Question 5: Why should R professionals avoid using attach() in production scripts?
- It pollutes the search path and can cause hard-to-debug variable name conflicts (Correct answer)
- It is deprecated and removed from base R
- It significantly slows down data frame access
- It only works with data frames, not tibbles
Correct answer: It pollutes the search path and can cause hard-to-debug variable name conflicts
attach() adds a data frame to the search path, creating risks of silent name masking that are difficult to trace.
Question 6: What does semantic versioning (e.g., 1.2.3) communicate to users of an R package?
- Major.Minor.Patch — indicating breaking changes, new features, and bug fixes respectively (Correct answer)
- Release year, month, and day of the package
- The R version required to run the package
- The number of functions, datasets, and vignettes in the package
Correct answer: Major.Minor.Patch — indicating breaking changes, new features, and bug fixes respectively
Semantic versioning uses a three-part number to communicate the nature of changes and help users assess upgrade risk.
Question 7: Which behavior demonstrates peer-review best practices when collaborating on an R package?
- Submitting pull requests with clear descriptions and responding constructively to reviewer feedback (Correct answer)
- Merging changes directly to the main branch without review to save time
- Refusing to review others' code to maintain neutrality
- Only reviewing code written by junior team members
Correct answer: Submitting pull requests with clear descriptions and responding constructively to reviewer feedback
Structured pull requests with descriptive context and open communication improve code quality and team cohesion.
Which practice aligns with ethical data handling standards when working with personal data in R?