File structure
Documents folder.setwd(PATH/TO/NEW/WORKING/DIRECTORY) to change the working directory.getwd() to see your current working directory.Consider the following file structure
There are two ways of specifying a path:
/ (root)
├── home
│ └── user
│ ├── documents
│ │ ├── course
│ │ │ ├── THIS_MARKDOWN.rmd
│ │ │ └── IMAGE.png
│ │ └── notes.txt
│ └── downloads
| └── data.csv
└── varReminder for Windows system
\ instead of / in your file explorer. In R, you need to transform these \s to / if you directly copy and paste the file path.C:\Users\Ray\Blah\BlahAbsolute Path
An absolute path starts from the root directory (/) and specifies the full path to a file or directory.
THIS_MARKDOWN.rmd: /home/user/documents/course/THIS_MARKDOWN.rmddata.csv: /home/user/downloads/data.csvRelative Path
A relative path is defined relative to the current working directory.
./ refers to the current directory,../ means “go up one directory level”.Assume that we are working on THIS_MARKDOWN.rmd, so the current directory is /home/user/documents/course.
IMAGE.png : ./IMAGE.png or IMAGE.pngdata.csv: ../../data.csv