How to set up a reproducible and collaborative workflow
Code smells, projects and scaffolding
Restart R Session
(shift + cmd + 0
).• When you quit R, do not save the workspace to an .Rdata
file.
• When you launch, do not reload the workspace from an .Rdata
file.
• In RStudio, set this via Preferences > Options > General.
setwd("/Users/jenny/cuddly_broccoli/verbose/...")
setwd()
command having the desired effect – making the file paths work – for anyone besides its author is 0%.Projects
• Create a project with the top-left icon next to New file
, or from the Command Palette.
• Open and manage Projects
from the top-right drop-down menu.
• You can also open projects by double clicking on the *.Rproj
file in your filesystem.
{here}
df
.“There are only two hard things in Computer Science: cache invalidation and naming things.”
Filenames, commands and documentation
_
to delimit words.-
to delimit meta-data fields. .
├── data
│ ├── external # external data that does not belong to raw
│ ├── interim # intermediate manipulations
│ ├── processed # final data used for analysis/models
│ └── raw # raw data should never change!
├── reports # notebooks with analysis and exploration
├── src # contains the source code, also named `R`
├── your-proj.Rproj # ❗Project file
└── README.md # info about the project
.
├── data
├── R # contains the R code
├── your-proj.Rproj # ❗Project file
└── README.md # info about the project
cmd + shift + P
calls the command palette: from there, you can call any command.vignettes
:A vignette is like a book chapter or an academic paper: it can describe the problem that your package is designed to solve, and then show the reader how to solve it.
browseVignettes()
and view one with vignette('your-vignette')
.{lintr}
as a static analysis tool:It checks for adherence to a given style, identifying syntax errors and possible semantic issues, then reports them to you so you can take action.
{styler}