-
Notifications
You must be signed in to change notification settings - Fork 1
/
prez.Rmd
325 lines (190 loc) · 6.4 KB
/
prez.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
---
title: "Introduction to Git and GitHub with RStudio"
author: "Olivier Gimenez"
date: "15/09/2020"
output:
xaringan::moon_reader:
css: [default, metropolis, assets/css/footer.css, metropolis-fonts, assets/css/metropolis-ak_dc.css]
lib_dir: libs
nature:
beforeInit: "https://platform.twitter.com/widgets.js"
highlightStyle: github
titleSlideClass: [middle, left]
highlightLines: true
countIncrementalSlides: false
---
layout: true
<div class="my-footer"><span> HAIR meeting
             
             
@oaggimenez <a href="https://twitter.com/oaggimenez">`r shiny::icon("twitter")` </a>
oliviergimenez <a href="https://github.com/oliviergimenez">`r shiny::icon("github-alt")` </a>
</span></div>
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(magrittr)
```
---
# Rings a bell?
<center>
<img src="http://www.phdcomics.com/comics/archive/phd101212s.gif" height="500px">
</center>
---
# Is your workflow...
<center>
<img src="assets/definitions.jpg" width="700px" />
</center>
---
# Why reproducible science?
<center>
<img src="assets/natureCapture.png" width="700px" />
</center>
---
# Why reproducible science?
<center>
<img src="assets/leMonde_science.png" width="700px" />
</center>
---
# Version Control
### What is it? `r emo::ji("thinking")`
The **management of changes** to documents, computer programs, large web sites, and other collections of information.
### Git <img src="https://git-scm.com/images/logos/downloads/Git-Logo-2Color.png" height="25px" >
Open source (free to use) **Version control software.**
### GitHub <img src="https://raw.githubusercontent.com/annakrystalli/rrresearch/master/docs/assets/github_logo.jpg" height="25px">
A **website** (https://github.com/) that allows you to **store your Git repositories online** and makes it easy to collaborate with others.
---
# Git, Github & RStudio
#### Before: git only through the terminal `r emo::ji("cry")`
--
***
## Now: RStudio + `usethis` `r emo::ji("package")` == `r emo::ji("heart")` `Git` & `GitHub` `r emo::ji("star_struck")`
.center[
![](https://media.giphy.com/media/GA2FNpP1kAQNi/giphy.gif)
]
---
# Configure git & GitHub
### Configure git
**Check your configuration**
```{r, eval=FALSE}
usethis::git_sitrep()
```
**Set your configuration**
Use your github username and and the email you used to sign-up on GitHub
```{r, eval=FALSE}
usethis::use_git_config(
user.name = "Jane",
user.email = "jane@example.org")
```
---
# Configure GitHub authentication
### Get GITHUB Personal Authorisation Token
```{r, eval=F}
usethis::browse_github_pat()
```
<img src="assets/browse_github.png" height="300px">
---
### Store in `.Renviron` file
```{r, eval=F}
usethis::edit_r_environ()
```
<img src="assets/GITHUB_PAT.png" height="400px">
---
# Initialise git
### Initialise **RStudio project** with Git by **just checking a box!**
It's now **a repository**
<img src="assets/project_git.png" height="200px">
---
# RStudio Projects
## Use RStudio projects to keep materials associated with a particular analysis together
<br>
.pull-left[
- **Self contained** and **portable**
- **Working directory set to root** of project on launch
- **Fresh session** everytime the project is launched
See Jenny Bryan's post on [**project oriented workflows**](https://www.tidyverse.org/articles/2017/12/workflow-vs-script/) for more details
]
.pull-right.center[
**File > New Project > New Directory**
<img src="assets/new_project.png" height=200px>
]
---
# Git panel
## Integrated graphical user interface
<br>
.center[
<img src="assets/git_tab.png" height="300px">
]
---
# Git terms
* **repository** your project folder
<br>
* **commit** a snapshot of your repo
<br>
* **push** send commits to a remote
<br>
* **pull** get commits from a remote
<br>
* (*clone* get the repository from the remote for the first time)
* (*branch* a movable label that points to a commit)
* (*merge* combining two branches)
* (*remote* a computer with the repository on it)
---
# Git RStudio workflow
.pull-left[
#### view file status
<img src="assets/git_view.png" height="150px">
#### stage files
<img src="assets/git_add.png" height="150px">
]
.pull-right[
#### commit changes
<img src="assets/git_commit.png" width="600px">
]
---
# Share on GitHub
#### Create repo
```{r, eval=FALSE}
usethis::use_github(protocol = "https")
```
<img src="assets/my_awesome_repo.png" width="750px">
#### Push further changes
<img src="assets/push_github.png" height="50px">
---
# Anatomy of a GitHub repo
- **`README`**. Explain what your project is, and how to use it.
+ `usethis::use_readme_md()`
+ `usethis::use_readme_rmd()`
- **`LICENSE`**. Without a licence, the contents of the repository are technically closed.
+ Examples licence [MIT](https://tldrlegal.com/license/mit-license): `usethis::use_mit_license(name = "Olivier Gimenez")`
+ `?licenses`: details of functions available to generate licenses
+ [https://choosealicense.com/](https://choosealicense.com/) help on choosing a licence.
- **`CONTRIBUTING.md`** - guidelines for contributors.
+ `usethis::use_tidy_contributing()` provides a realtively strict but instructive template
- **`CODE_OF_CONDUCT.md`** set the tone for discourse between contributors.
+ `use_code_of_conduct()`
---
# GitHub issues
### use GitHub issues to plan, record and discuss tasks.
<img src="assets/github_issues.png" width="800px">
---
# Why using a remote like GitHub ?
* A backup of your repository
* Work with others (not covered)
* Increase your visibility
* Increase interactions with users
* Easy distribution of packages (without CRAN submissions)
---
# Resources
<br>
#### I used many slides from [Anna Krystalli](https://annakrystalli.me/)
<br>
#### Also, see our [FRB-Cesab and GDR EcoStat Workshop on reproducible research in ecology](https://frbcesab.github.io/datatoolbox/index.html#1)
<br>
#### Check out [Happy Git and GitHub for the useR](https://happygitwithr.com/) for more
<br>
#### The British Ecological Society has [A Guide to Reproducible Code in Ecology and Evolution](https://colauttilab.github.io/Readings/BES-Reproducible-Code.pdf)
---
# Virtuous research cycle
<center>
<img src="assets/researchcycle.jpg" width="700px" />
</center>