Skip to main content
R-FOR-DATA5 MIN READ

Make project paths boring with here()

Use project-root-relative paths instead of local machine paths.

If a path contains your username, the analysis is not portable yet. The mechanism Project-oriented paths make R work portable. The here approach anchors file references at the project root, so scripts can refer to here("data", "raw", "orders.csv") instead of a personal desktop or a fragile working directory. The mechanism is environmental independence: the project root is discovered from project files, and every path is built relative to that shared root. This matters in teams because RStudio sessions, scheduled jobs, Quarto renders, and CI runs may start from different working directories. setwd() hides that fragility by mutating state; root-relative paths…

Read the full lesson

Sign up free — one personalized lesson every day, matched to your role and goals.

Already have an account? Sign in

← Back to library
Contact us