-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path00-setup.Rmd
61 lines (44 loc) · 2.44 KB
/
00-setup.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Project Setup {-}
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, cache = TRUE)
```
The goal of this section is to help you:
- Set up a directory on your computer to store scripts and data for this workshop
- Back up all workshop materials online using Github
## Prerequisites for Git workflow {-}
- You have a Github account. If not, [create one here](https://github.com/).
- You have Git on your computer. Check by typing
```{}
git --version
```
in the Terminal pane in RStudio. Macs should already have Git, Windows will need to install [Git Bash](https://git-scm.com/download/win) on their computer.
- You have configured Git. Check by typing
```{}
git config --list
```
in the Terminal pane in RStudio. If you have not configured git, follow [these instructions](https://happygitwithr.com/hello-git.html).
## Workflow with Git {-}
```{block type="rmdwarning"}
Make sure you have the prerequisites for this workflow (see above section), otherwise you'll be frustrated.
```
1. Go to [github.com](https://github.com/) and create a new repository. Choose to make it public or private (your choice). Initialize with a README.
2. Open RStudio. Click "New Project". Click "Version Control". Paste the URL of the repository you just created.
3. Create the following folders in your project by clicking on "New Folder" in the Files pane in RStudio:
- `data`
- `doc`
- `R`
Put data in `data`, written output in `doc`, and R code scripts in `R`.
4. Once you've put data and scripts in, you can back up your documents by going to the tab in RStudio called "Git".
- Check the checkbox next to the items you'd like to back up.
- Click "Commit". Type an informative message, i.e. "Added materials from first workshop".
- Click "Push". You have now uploaded your files to Github. If you go to the web link of the repository you created on Github, your materials should now be there.
## Workflow without Git {-}
1. Open RStudio. Click "New Project". Click "New Directory".
2. Create the following folders in your project by clicking on "New Folder" in the Files pane in RStudio:
- `data`
- `doc`
- `R`
Put data in `data`, written output in `doc`, and R code scripts in `R`.
## Additional reading {-}
- [Happy Git with R](https://happygitwithr.com/): the comprehensive guide on how to use Git/Github with R
- [Project Management with RStudio](https://swcarpentry.github.io/r-novice-gapminder/02-project-intro/): great resource for organizing your research files and scripts