-
Notifications
You must be signed in to change notification settings - Fork 0
/
describe.qmd
48 lines (27 loc) · 1 KB
/
describe.qmd
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
# Describe
## getting a feel for your data
`str`
`glimpse`
`skimr`
## counting things
`group_by` + `summarise` + `count`
`n`
`tabyl`
## getting descriptives
`group_by` + `summarise` + `mean` & `sd`
```{r eval = FALSE}
scale1_by_condition12 <- data_scalescomputed %>%
group_by(condition12) %>%
summarise(mean_scale1 = mean(scale1_index, na.rm = TRUE),
sd_scale1 = sd(scale1_index, na.rm = TRUE))
```
### Three things to remember
1. When we compute means, we need to set the decimals via `round()`.
2. We also need to tell R to calculate the mean, even if some of the contributing data points are missing. This is what `na.rm = TRUE` does.
3. As noted above, `rowwise` asks R to do something for each row (which is what we want here -- to compute the mean of the contributing items for each participant). Whenever we use `rowwise` (or `group_by`), we need to `ungroup()` at the end to avoid issues down the line.
## tables??
`gt`
```{r eval = FALSE}
gt(scale1_by_condition12)
```
`apaTable`