-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathexercise_A3.R
48 lines (33 loc) · 927 Bytes
/
exercise_A3.R
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
library(rtables)
library(dplyr)
# for illustrative purposes (smaller table)
ex_adsl3 <- ex_adsl |>
mutate(B1HL = factor(ifelse(BMRKR1 > mean(BMRKR1), "H", "L"), levels = c("L", "H")))
View(ex_adsl3[, c("B1HL", "BMRKR1")])
# Stage 1
lyt <- basic_table()
build_table(lyt, ex_adsl3)
# Stage 2
lyt <- basic_table() |>
split_cols_by("ARM")
build_table(lyt, ex_adsl3)
# Stage 3
lyt <- basic_table() |>
split_cols_by("ARM") |>
split_cols_by("B1HL")
build_table(lyt, ex_adsl3)
# Stage 4
lyt <- basic_table() |>
split_cols_by("ARM") |>
split_cols_by("B1HL") |>
split_rows_by("SEX") |>
analyze("AGE", function(x) "")
build_table(lyt, ex_adsl3)
# Go ahead and nest the row structure by other categorical variables
lyt <- basic_table() |>
split_cols_by("ARM") |>
split_cols_by("B1HL") |>
split_rows_by("SEX") |>
split_rows_by( ) |>
analyze("AGE", function(x) "")
build_table(lyt, ex_adsl3)