Relative and Absolute Paths

  • A relative path is relative to the working directory, i.e. the project’s home.
  • Absolute paths point to the same place regardless of your working directory.
    • Mac/Linux: a slash /
      • /Users/hadley/Documents/r4ds/data/diamonds.csv
    • Windows: backlashes \
      • \Users\hadley\Documents\r4ds\data\diamonds.csv
  • R can work with either type, but is recommended to always use Mac/Lynux style /.
  • You should never use absolute paths in your scripts, because they hinder sharing.