- Organize Your R Analysis Using Projects in Rstudio
- Ensure at least three folders exist:
code
,data
, andfigures
. - Tip: use analysistemplates package
remotes::install_github("jonas-hag/analysistemplates")
- Ensure at least three folders exist:
- Use
{here}
and Avoidsetwd
- Never use
setwd
, ever.
- Never use
- Divide Analysis into Specific Scripts
- Use at least
01_data_acquisition_cleaning
and02_exploratory_data_analysis
. Create additional scripts for modeling as needed.
- Use at least
- Store Data Frames as RDS in
data
Folder- The output of file
01
should be a data frame, preferably stored as an RDS for retaining order and metadata. If no relevant metadata/ordered levels are in the dataframe, a csv file will suffice.
- The output of file
- Maintain a Clutter-Free Environment Tab
- Promptly remove unnecessary objects.
- Include Package References at the Beginning
- Use
package::function
syntax for specific function calls.
- Use
- Comment Everything and Everywhere
- Never assume you will remember your reasoning or logic in the future.
- Adhere to the Google R Style Guide
- Regularly apply Control+Shift+A for automatic formatting.
Last active
January 10, 2025 07:21
-
-
Save sergiouribe/d01b4a11c44905f2232ce93c539bdd7a to your computer and use it in GitHub Desktop.
Code Reproducibility Good Practices
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment