R Programming Language Certification Professional Standards & Competencies 2 — Questions and Answers
Question 1: Which practice best demonstrates reproducible research in R?
- Using R Markdown to combine code, output, and narrative (Correct answer)
- Saving only final results to CSV files
- Running scripts interactively without saving them
- Hardcoding absolute file paths in all scripts
Correct answer: Using R Markdown to combine code, output, and narrative
R Markdown integrates code, output, and documentation so analyses can be re-run and verified by others.
Question 2: A data scientist shares an R project with a colleague who cannot reproduce results due to different package versions. What is the best preventive measure?
- Use renv to snapshot and restore the project library (Correct answer)
- Email the colleague your entire R installation folder
- Hardcode all function outputs as constants
- Avoid using external packages altogether
Correct answer: Use renv to snapshot and restore the project library
renv creates a project-level lockfile recording exact package versions, enabling consistent environments across machines.
Question 3: When publishing a statistical analysis, which action upholds professional data integrity standards?
- Reporting all conducted tests, including non-significant results (Correct answer)
- Reporting only analyses that confirm the hypothesis
- Rounding p-values up to the nearest significant threshold
- Removing outliers without documenting the decision
Correct answer: Reporting all conducted tests, including non-significant results
Reporting all analyses, including null results, prevents publication bias and upholds scientific integrity.
Question 4: Which versioning strategy is recommended for collaborative R projects to track code changes?
- Git with a hosted repository such as GitHub or GitLab (Correct answer)
- Saving numbered copies of scripts like script_v1.R, script_v2.R
- Storing all versions in a single R script with commented-out sections
- Emailing updated scripts to team members after each change
Correct answer: Git with a hosted repository such as GitHub or GitLab
Git provides full change history, branching, and collaboration features essential for professional R projects.
Question 5: What does the principle of 'separation of concerns' mean in the context of an R project?
- Splitting data loading, processing, and reporting into distinct scripts or functions (Correct answer)
- Keeping all project code in a single script for portability
- Avoiding the use of functions to prevent complexity
- Storing raw and processed data in the same directory
Correct answer: Splitting data loading, processing, and reporting into distinct scripts or functions
Separation of concerns improves maintainability by assigning distinct responsibilities to different parts of the codebase.
Question 6: An R developer discovers that a widely-used function in their package has a critical bug. What is the professionally responsible next step?
- Release a patch version immediately and document the fix in NEWS.md (Correct answer)
- Quietly fix the bug without notifying users to avoid concern
- Deprecate the entire package and start over
- Wait for users to report the bug before acting
Correct answer: Release a patch version immediately and document the fix in NEWS.md
Releasing a patch promptly and documenting it transparently protects users and maintains trust in the package.
Question 7: Which R coding style guideline helps maintain consistent, readable code across a team?
- Following the tidyverse style guide and using tools like styler or lintr (Correct answer)
- Each developer using their own preferred naming conventions freely
- Minimizing whitespace to reduce file size
- Writing all code as one-liners for compactness
Correct answer: Following the tidyverse style guide and using tools like styler or lintr
Shared style guides enforced by automated tools like lintr reduce code review friction and improve readability.
Which practice best demonstrates reproducible research in R?