-
Notifications
You must be signed in to change notification settings - Fork 0
/
01-setup.Rmd
107 lines (63 loc) · 3.7 KB
/
01-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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# (PART) Setup {-}
# Setup
## R
Download and install the [latest version of R](https://cran.r-project.org/).
<!-- When migrating to a new version of R, this line might help updating packages. -->
<!-- update.packages(checkBuilt = TRUE, ask = FALSE) -->
## RStudio
Download and install the [latest version of RStudio](https://www.rstudio.com/products/rstudio/download/#download).
There are a couple of useful settings to change in RStudio.
* Tools / Global Options / Workspace: Restore .Rdata at startup = OFF
* Tools / Global Options / Workspace: Save workspace to .Rdate on exit = Never
See [Efficient R / Rstudio options](https://csgillespie.github.io/efficientR/set-up.html#rstudio-options) for more information.
## System dependencies
Windows users: install [RTools](https://cran.r-project.org/bin/windows/Rtools/).
Mac users: install [Xcode](https://developer.apple.com/xcode/resources/) and [homebrew](https://brew.sh/).
### Spatial packages
To use spatial packages (eg.: `sf`), we need to install some system dependencies. The `sf` [README](https://github.com/r-spatial/sf#installing) has great instructions. Make sure to install these dependencies before trying to install spatial packages.
You may also find it easier to install using the R-universe version of packages, for example:
```{r, eval = FALSE}
# Enable this universe
options(repos = c(
rspatial = 'https://r-spatial.r-universe.dev',
r_spatial = 'https://rspatial.r-universe.dev',
CRAN = 'https://cloud.r-project.org'))
# Install sf and terra packages
install.packages(c('sf', 'terra'))
```
### R Markdown {#rmd-setup}
Install packages
```{r, eval = FALSE}
install.packages(c('rmarkdown', 'bookdown', 'knitr'))
```
and [`tinytex`](https://yihui.org/tinytex/) helps us get TeX easily installed on your computer.
```{r, eval = FALSE}
install.packages('tinytex')
tinytex::install_tinytex()
```
After installing `tinytex`, make sure to restart RStudio.
## Git {#git-setup}
Quick setup instructions here, but see the chapter on [Git](#git) for more details.
### Install git
Check out the great instructions in [Happy Git With R](https://happygitwithr.com/install-git.html). Be sure to check if `git` is installed first!
### Hosting services
Historically, the lab primarily uses [GitLab](https://gitlab.com) for private
and group projects and [GitHub](https://github.com) for mirroring published
projects or packages. This was largely dictated by GitHub's lack of free, private
repositories, and GitLab's great continuous integration tools. Nowadays, the
line is less clear - GitHub offers free private repositories and GitHub Actions.
GitHub is more commonly used, especially in R package development. Take your pick
or use both!
1. Make an account on [GitHub](https://github.com/signup?user_email=&source=form-home-signup)
or [GitLab](https://gitlab.com/users/sign_in) (or both), and message Alec your usernames.
1. Setup global git user name and email. See [here](https://happygitwithr.com/hello-git.html).
1. Setup a local folder on your computer to store all of your git repositories. I use a folder called 'Local-git' under Documents (`/home/alecr/Documents/Local-git`).
You can alternatively clone your repositories to different places on your hard
drive, but I find it more straightforward to keep everything together.
### Git clients
You may opt to use a git client to work with git on a regular basis. Again, see
a great discussion in the Happy Git With R book
[here](https://happygitwithr.com/git-client.html). We've tried using cross
platform clients in the past to make it easy for folks to help each other.
Recently, it has been [GitAhead](https://gitahead.github.io/gitahead.com/) - but
development on it has recently halted... Next step TBD.