forked from katiejolly/met-council-R
-
Notifications
You must be signed in to change notification settings - Fork 0
/
02-rprojects.Rmd
33 lines (20 loc) · 1.89 KB
/
02-rprojects.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
# R Projects
When working on an analysis with R, the recommended workflow is to use [R Projects](https://r4ds.had.co.nz/workflow-projects.html). This is also called ["project-oriented workflow"](https://www.tidyverse.org/articles/2017/12/workflow-vs-script/) in some other tutorials.
Projects are nice because they keep all of the data, code, writing, etc. for a particular task in one place. You don't have to worry about working directories and reproducibility is more straightforward. It allows you to use relative versus absolute pathnames, this is awesome when working with collaborators.
Let's make a project for this workshop!
## Set up your project: Cloud
In your RStudio cloud workspace, click the `New Project` button to start a project. Once it is open, you can name it by `Untitled Project` where it says `Your Workspace/Untitled Project` at the top of the screen. Name it something short but meaningful with no spaces or special characters except `-` or `_`.
## Set up your project: Desktop
In the upper right corner of your RStudio window, you'll see `Project: (None)`. Click on that, then select `New Project...`. Next select `New Directory`.
```{r echo = FALSE}
knitr::include_graphics("images/03-03-newproject.png")
```
Then select `New Project` from the list of options.
```{r echo = FALSE}
knitr::include_graphics("images/03-01-newproject.png")
```
Then you can name your project (think of it as naming the folder where you'll keep all of your work). I like to include the date in my file names as well. The second part (`Create project as a subdirectory of:`) is where you want this folder to live on your computer. The default for Windows is your Documents/ folder.
```{r echo = FALSE}
knitr::include_graphics("images/03-02-newproject.png")
```
Once you've done that, click `Create Project`. You should now see your current project name in the corner where before you saw `Project: (None)`.