-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpathdirectories.Rmd
43 lines (33 loc) · 1.18 KB
/
pathdirectories.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Paths and directories
* The path of a file/directory is its **location/address** in the file system.
* Your home directory is the one that hosts your personal folder:
+ for CRG users: **/nfs/users/[yourgroup]/[yourusername]**
## Tree of directories
<a href="https://sbcrg.github.io/CRG_RIntroduction/images/tree_directories.png"><img src="images/tree_directories.png" alt="rstudio logo" width="1000"/></a>
<br>
<font size="12"> <b>~</b></font>: shortcut to the home directory
<br>
<font size="12"> <b>.</b></font>: current directory
<br>
<font size="12"> <b>..</b></font>: one directory up the tree
## Navigate the tree of directory with the R terminal
* Get the path of the current directory (know where you are working at the moment) with <b>getwd</b> (get working directory):
```{r, eval=FALSE}
getwd()
```
* Change working directory with **setwd** (set working directory)<br>
Go to a directory giving the absolute path:
```{r, eval=FALSE}
setwd("~/Rcourse")
```
Go to a directory giving the relative path:
```{r, eval=FALSE}
setwd("Module1")
```
You are now in: "~/Rcourse/Module1"
<br>
Move one directory "up" the tree:
```{r, eval=FALSE}
setwd("..")
```
You are now in: "~/Rcourse"