-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoutline.qmd
More file actions
216 lines (111 loc) · 4.83 KB
/
outline.qmd
File metadata and controls
216 lines (111 loc) · 4.83 KB
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
---
title: "Two-day R data-science workshop"
date-modified: 'today'
date-format: long
license: CC BY-NC
bibliography: references.bib
---
## Day One:
### Part 1 - getting started
- What is R
- data-first programming/coding language
- extend R with domain-specific **packages**. See: [MetaCran](https://www.r-pkg.org/), [CRAN](https://cran.r-project.org/), github, [bioconductor](https://www.bioconductor.org/)
- What is the [Tidyverse](https://www.tidyverse.org/)
- What is [Tidy data](https://r4ds.had.co.nz/tidy-data.html)
- **Reproducibility**: data-first tools help leverage reproducible workflows throughout computational thinking
- blank-slate instead of .Rdata
- Restart instead of `rm(list = ls())`
- Intentional use of the RStudio projects feature
- Version Control: git and GitHub
- {`renv`} for archiving/documenting package environments
- Tool suite
- RStudio
- Quarto Notebooks (Merge literate coding with report rendering)
- {`dplyr`} & {`tidyr`} - a grammar for data wrangling
- {`ggplot2`} - a grammar of graphics
- Other packages e.g. {`readr`}, {`forcats`}, {`stringr`}, {`purrr`}, {`tidymodels`}
- Console
- basic computation
- vectors and vectorized math
- environment variables and data variables
- **assignment** variables: `<-` and `=` (not the same as equivalency `==`)
- **pipe**s = `|>` and `%>%`
- RStudio [Projects](https://docs.posit.co/ide/user/ide/guide/code/projects.html)
- use projects instead of `setwd()` ; relative paths are vital to reproducibility
- Documents: Quarto document
- Import CSV data
- `read_csv()` and the data import wizard found in *Files* tab and *Environment* tab
- Other data formats
- {`readxl`}, {`haven`}
- SQL
- Code-chunks can perform SQL
- {`dbplyr`}
- [Best Practices with Databases](https://solutions.posit.co/connections/db/)
- **Exercise**
- import a CSV file
- import a Stata categorical file using {*haven*}
- {`dplyr`}
- select(), filter(), arrange(), mutate(), group_by(), summarize(), count()
- **Exercise**
- Semantic meaning in data
- Codebooks in a literate coding context
\
### Part 2 - visualization plus EDA
- {ggplot2} viz
- **Exercise**
- basic interactivity - ggplotly()
- **Exercise**
- {`broom`} and handling modeling outputs (e.g. linear regression)
- Advertise {`tidymodels`}
- **Exercise**
- {skimr} and EDA
- skim()
- Reprise group_by() and summarize()
- {`tidyr`} pivot_longer() and pivot_wider()
- **Tall data** - what is it?
- Tall data for iteration: computation
- Tall data for visualization , facet_wrap()
- Tall data for modeling ; {purrr} a first look.
- join with `dplyr::left_join()` or other {`dplyr`} join functions
- Wrap-up and Summarize the day
\
## Day Two
### Part 3 Iteration and custom functions
- Questions from yesterday
- R is a functional programming language
- What is functional programing?
- Customizing functions and iterating without FOR loops
- FOR loops?
- Tidyverse preference for data frames
- Vectorized math (review)
- Vectorized iteration ; environment variables and data variables
- Case study - import multiple data files + data cleaning + analysis + visualization
- read_csv() again
- Introduce {`stringr`} and regular expressions
- Some nifty data wrangling functions
- Composing custom functions
- Nesting data for iteration
\
### Part 4 Review, questions, case study, reports
- Questions / Review
- Setup case study
- Using R to orchestrate data workflows
- Reproducible report rendering (slides, PDF, dashboards, etc.)
- Summarize
- Finding help
## Resources
- R for Data Science: [book](https://r4ds.had.co.nz/) \| [slack](https://www.rfordatasci.com/)
- Tidyverse [primers](https://posit.cloud/learn/primers)
- RStudio IDE \> Help \> \[ Documentation \| Forum \| Cheatsheets \| Shortcuts \] & on-board *Help* tab
- [RStudio User Guide](https://docs.posit.co/ide/user/)
- Tidyverse webpages: {`package_name`}.tidyverse.org (e.g. ggplot2.tidyverse.org)
- Interactivity
- [HTMLWidgets](https://www.htmlwidgets.org)
- [ObservableJS](https://quarto.org/docs/interactive/ojs/)
- [Shiny](https://shiny.rstudio.com/)
## Recommendations
- [Blank slate](https://docs.posit.co/ide/user/ide/get-started/#blank-slate)
- Use the Projects in the RStudio IDE
- Use version control (git and GitHub)
- Use {[`renv`](https://rstudio.github.io/renv/index.html)} for package reproducible environments
- Use [mybinder.org](https://mybinder.org/) for sharing containers in a reproducible/replicable state