-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.Rmd
128 lines (78 loc) · 2.55 KB
/
index.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
---
title: "Research with R and RStudio: A workflow"
author: "Stefano Coretta"
date: "`r Sys.Date()`"
output:
xaringan::moon_reader:
css: xaringan-themer.css
lib_dir: libs
nature:
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
beforeInit: "macros.js"
---
```{r setup, include=FALSE}
options(htmltools.dir.version = FALSE)
xaringanExtra::use_xaringan_extra(c("panelset", "tachyons"))
```
```{r xaringan-themer, include=FALSE, warning=FALSE}
library(xaringanthemer)
style_mono_accent(
base_color = "#1c5253",
header_font_google = google_font("Josefin Sans"),
text_font_google = google_font("Montserrat", "300", "300i"),
code_font_google = google_font("Fira Mono")
)
```
# RStudio
.center[![:scale 85%](img/rstudio.png)]
---
# RStudio options
.center[![:scale 60%](img/general-options.png)]
---
# RStudio projects
RStudio **projects** are self-contained environments in which you keep code and data.
.center[![:scale 70%](img/new-project.png)]
---
# RStudio projects
.pull-left[
Advantages
- You can open and work on **multiple projects** at a time.
- The files of each individual projects are easily accessible by using **relative paths**, so goodby to `setwd()` (for example `./data/results.csv` if your project has a file `results.csv` in the `data/` folder).
- You can **isolate** package **dependencies** with `renv`.
- It simplifies the **distribution** of your research (for example, as an R package).
]
--
.pull-right[
Disadvantages
- **None**!
]
---
# Organising folders and files
From the [Open Science Framework](http://help.osf.io/m/bestpractices/l/611391-organizing-files).
* Separate DATA and CODE.
* Separate RAW data and DERIVED data.
* Treat raw data as READ-ONLY.
* Use a versioning system (like `git` with GitHub).
---
# Research compendia with R packages
* <https://github.com/ropensci/rrrpkg>
* <https://www.r-bloggers.com/how-to-develop-good-r-packages-for-open-science/>
* <http://r-pkgs.had.co.nz>
---
# R Markdown
**Dynamic report** writing in R with R Markdown and `knitr`.
* <http://rmarkdown.rstudio.com>
* Text and code in a single document (`.Rmd`).
* Several output formats (`.html`, `.pdf`, `.docx`, ...).
* R Markdown templates for journal submissions: <https://github.com/rstudio/rticles>.
---
# R Markdown
.center[![:scale 85%](img/rmarkdown.png)]
---
# Summary
* Use **RStudio**.
* **Don't save `.Rdata`** and do not load it at start up.
* Separate **code** and **data** (*raw* and *derived*).
* Use **dynamic reports** with R Markdown (avoid copy-paste).