split_fun <- drop_split_levelslyt <-basic_table(show_colcounts =TRUE) %>%split_cols_by("ACTARM") %>%analyze_num_patients(vars ="USUBJID",count_by ="CMSEQ",.stats =c("unique", "nonunique"),.labels =c(unique ="Total number of patients with at least one treatment",nonunique ="Total number of treatments" ) ) %>%split_rows_by("ATC2",child_labels ="visible",nested =FALSE,split_fun = split_fun,label_pos ="topleft",split_label =obj_label(adcm$ATC2) ) %>%summarize_num_patients(var ="USUBJID",count_by ="CMSEQ",.stats =c("unique", "nonunique"),.labels =c(unique ="Total number of patients with at least one treatment",nonunique ="Total number of treatments" ) ) %>%count_occurrences(vars ="CMDECOD", .indent_mods =-1L) %>%append_varlabels(adcm, "CMDECOD", indent =1L)result <-build_table(lyt = lyt, df = adcm, alt_counts_df = adsl) %>%prune_table() %>%# Sort lowest level terms by descending frequency.sort_at_path(path =c("ATC2", "*", "CMDECOD"),scorefun = score_occurrences )result
ATC Level 2 Text A: Drug X B: Placebo C: Combination
Other Treatment (N=134) (N=134) (N=132)
———————————————————————————————————————————————————————————————————————————————————————————————————
Total number of patients with at least one treatment 117 (87.3%) 116 (86.6%) 116 (87.9%)
Total number of treatments 415 414 460
ATCCLAS2 A
Total number of patients with at least one treatment 75 (56.0%) 79 (59.0%) 81 (61.4%)
Total number of treatments 134 137 143
medname A_2/3 53 (39.6%) 50 (37.3%) 56 (42.4%)
medname A_3/3 45 (33.6%) 54 (40.3%) 48 (36.4%)
ATCCLAS2 A p2
Total number of patients with at least one treatment 45 (33.6%) 54 (40.3%) 48 (36.4%)
Total number of treatments 58 66 64
medname A_3/3 45 (33.6%) 54 (40.3%) 48 (36.4%)
ATCCLAS2 B
Total number of patients with at least one treatment 83 (61.9%) 74 (55.2%) 88 (66.7%)
Total number of treatments 141 137 162
medname B_1/4 52 (38.8%) 57 (42.5%) 59 (44.7%)
medname B_4/4 50 (37.3%) 45 (33.6%) 55 (41.7%)
ATCCLAS2 B p2
Total number of patients with at least one treatment 52 (38.8%) 57 (42.5%) 59 (44.7%)
Total number of treatments 75 82 83
medname B_1/4 52 (38.8%) 57 (42.5%) 59 (44.7%)
ATCCLAS2 B p3
Total number of patients with at least one treatment 52 (38.8%) 57 (42.5%) 59 (44.7%)
Total number of treatments 75 82 83
medname B_1/4 52 (38.8%) 57 (42.5%) 59 (44.7%)
ATCCLAS2 C
Total number of patients with at least one treatment 82 (61.2%) 84 (62.7%) 89 (67.4%)
Total number of treatments 140 140 155
medname C_2/2 52 (38.8%) 58 (43.3%) 60 (45.5%)
medname C_1/2 51 (38.1%) 50 (37.3%) 56 (42.4%)
ATCCLAS2 C p2
Total number of patients with at least one treatment 82 (61.2%) 84 (62.7%) 89 (67.4%)
Total number of treatments 140 140 155
medname C_2/2 52 (38.8%) 58 (43.3%) 60 (45.5%)
medname C_1/2 51 (38.1%) 50 (37.3%) 56 (42.4%)
ATCCLAS2 C p3
Total number of patients with at least one treatment 52 (38.8%) 58 (43.3%) 60 (45.5%)
Total number of treatments 69 73 80
medname C_2/2 52 (38.8%) 58 (43.3%) 60 (45.5%)
Experimental use!
WebR is a tool allowing you to run R code in the web browser. Modify the code below and click run to see the results. Alternatively, copy the code and click here to open WebR in a new tab.
split_fun <- drop_split_levelslyt <-basic_table(show_colcounts =TRUE) %>%split_cols_by("ACTARM") %>%analyze_num_patients(vars ="USUBJID",count_by ="CMSEQ",.stats =c("unique", "nonunique"),.labels =c(unique ="Total number of patients with at least one treatment",nonunique ="Total number of treatments" ) ) %>%split_rows_by("ATC1",child_labels ="visible",nested =FALSE,split_fun = split_fun,label_pos ="topleft",split_label =obj_label(adcm$ATC1) ) %>%summarize_num_patients(var ="USUBJID",count_by ="CMSEQ",.stats =c("unique", "nonunique"),.labels =c(unique ="Total number of patients with at least one treatment",nonunique ="Total number of treatments" ) ) %>%count_occurrences(vars ="CMDECOD", .indent_mods =-1L) %>%append_varlabels(adcm, "CMDECOD", indent =1L)result <-build_table(lyt = lyt, df = adcm, alt_counts_df = adsl) %>%prune_table() %>%# Sort lowest level terms by descending frequency.sort_at_path(path =c("ATC1", "*", "CMDECOD"),scorefun = score_occurrences )result
ATC Level 1 Text A: Drug X B: Placebo C: Combination
Other Treatment (N=134) (N=134) (N=132)
———————————————————————————————————————————————————————————————————————————————————————————————————
Total number of patients with at least one treatment 117 (87.3%) 116 (86.6%) 116 (87.9%)
Total number of treatments 415 414 460
ATCCLAS1 A
Total number of patients with at least one treatment 75 (56.0%) 79 (59.0%) 81 (61.4%)
Total number of treatments 134 137 143
medname A_2/3 53 (39.6%) 50 (37.3%) 56 (42.4%)
medname A_3/3 45 (33.6%) 54 (40.3%) 48 (36.4%)
ATCCLAS1 A p2
Total number of patients with at least one treatment 45 (33.6%) 54 (40.3%) 48 (36.4%)
Total number of treatments 58 66 64
medname A_3/3 45 (33.6%) 54 (40.3%) 48 (36.4%)
ATCCLAS1 B
Total number of patients with at least one treatment 83 (61.9%) 74 (55.2%) 88 (66.7%)
Total number of treatments 141 137 162
medname B_1/4 52 (38.8%) 57 (42.5%) 59 (44.7%)
medname B_4/4 50 (37.3%) 45 (33.6%) 55 (41.7%)
ATCCLAS1 B p2
Total number of patients with at least one treatment 52 (38.8%) 57 (42.5%) 59 (44.7%)
Total number of treatments 75 82 83
medname B_1/4 52 (38.8%) 57 (42.5%) 59 (44.7%)
ATCCLAS1 B p3
Total number of patients with at least one treatment 52 (38.8%) 57 (42.5%) 59 (44.7%)
Total number of treatments 75 82 83
medname B_1/4 52 (38.8%) 57 (42.5%) 59 (44.7%)
ATCCLAS1 C
Total number of patients with at least one treatment 82 (61.2%) 84 (62.7%) 89 (67.4%)
Total number of treatments 140 140 155
medname C_2/2 52 (38.8%) 58 (43.3%) 60 (45.5%)
medname C_1/2 51 (38.1%) 50 (37.3%) 56 (42.4%)
ATCCLAS1 C p2
Total number of patients with at least one treatment 82 (61.2%) 84 (62.7%) 89 (67.4%)
Total number of treatments 140 140 155
medname C_2/2 52 (38.8%) 58 (43.3%) 60 (45.5%)
medname C_1/2 51 (38.1%) 50 (37.3%) 56 (42.4%)
ATCCLAS1 C p3
Total number of patients with at least one treatment 52 (38.8%) 58 (43.3%) 60 (45.5%)
Total number of treatments 69 73 80
medname C_2/2 52 (38.8%) 58 (43.3%) 60 (45.5%)
Experimental use!
WebR is a tool allowing you to run R code in the web browser. Modify the code below and click run to see the results. Alternatively, copy the code and click here to open WebR in a new tab.
split_fun <- drop_split_levelslyt <-basic_table(show_colcounts =TRUE) %>%split_cols_by("ACTARM") %>%analyze_num_patients(vars ="USUBJID",count_by ="CMSEQ",.stats =c("unique", "nonunique"),.labels =c(unique ="Total number of patients with at least one treatment",nonunique ="Total number of treatments" ) ) %>%split_rows_by("ATC2",child_labels ="visible",nested =FALSE,split_fun = split_fun,label_pos ="topleft",split_label =obj_label(adcm$ATC2) ) %>%summarize_num_patients(var ="USUBJID",count_by ="CMSEQ",.stats =c("unique", "nonunique"),.labels =c(unique ="Total number of patients with at least one treatment",nonunique ="Total number of treatments" ) ) %>%count_occurrences(vars ="CMDECOD", .indent_mods =-1L) %>%append_varlabels(adcm, "CMDECOD", indent =1L)result <-build_table(lyt = lyt, df = adcm, alt_counts_df = adsl) %>%prune_table() %>%sort_at_path(path =c("ATC2"), scorefun = cont_n_allcols) %>%sort_at_path(path =c("ATC2", "*", "CMDECOD"), scorefun = score_occurrences)result
ATC Level 2 Text A: Drug X B: Placebo C: Combination
Other Treatment (N=134) (N=134) (N=132)
———————————————————————————————————————————————————————————————————————————————————————————————————
Total number of patients with at least one treatment 117 (87.3%) 116 (86.6%) 116 (87.9%)
Total number of treatments 415 414 460
ATCCLAS2 C
Total number of patients with at least one treatment 82 (61.2%) 84 (62.7%) 89 (67.4%)
Total number of treatments 140 140 155
medname C_2/2 52 (38.8%) 58 (43.3%) 60 (45.5%)
medname C_1/2 51 (38.1%) 50 (37.3%) 56 (42.4%)
ATCCLAS2 C p2
Total number of patients with at least one treatment 82 (61.2%) 84 (62.7%) 89 (67.4%)
Total number of treatments 140 140 155
medname C_2/2 52 (38.8%) 58 (43.3%) 60 (45.5%)
medname C_1/2 51 (38.1%) 50 (37.3%) 56 (42.4%)
ATCCLAS2 B
Total number of patients with at least one treatment 83 (61.9%) 74 (55.2%) 88 (66.7%)
Total number of treatments 141 137 162
medname B_1/4 52 (38.8%) 57 (42.5%) 59 (44.7%)
medname B_4/4 50 (37.3%) 45 (33.6%) 55 (41.7%)
ATCCLAS2 A
Total number of patients with at least one treatment 75 (56.0%) 79 (59.0%) 81 (61.4%)
Total number of treatments 134 137 143
medname A_2/3 53 (39.6%) 50 (37.3%) 56 (42.4%)
medname A_3/3 45 (33.6%) 54 (40.3%) 48 (36.4%)
ATCCLAS2 C p3
Total number of patients with at least one treatment 52 (38.8%) 58 (43.3%) 60 (45.5%)
Total number of treatments 69 73 80
medname C_2/2 52 (38.8%) 58 (43.3%) 60 (45.5%)
ATCCLAS2 B p2
Total number of patients with at least one treatment 52 (38.8%) 57 (42.5%) 59 (44.7%)
Total number of treatments 75 82 83
medname B_1/4 52 (38.8%) 57 (42.5%) 59 (44.7%)
ATCCLAS2 B p3
Total number of patients with at least one treatment 52 (38.8%) 57 (42.5%) 59 (44.7%)
Total number of treatments 75 82 83
medname B_1/4 52 (38.8%) 57 (42.5%) 59 (44.7%)
ATCCLAS2 A p2
Total number of patients with at least one treatment 45 (33.6%) 54 (40.3%) 48 (36.4%)
Total number of treatments 58 66 64
medname A_3/3 45 (33.6%) 54 (40.3%) 48 (36.4%)
Experimental use!
WebR is a tool allowing you to run R code in the web browser. Modify the code below and click run to see the results. Alternatively, copy the code and click here to open WebR in a new tab.
split_fun <- drop_split_levelslyt <-basic_table(show_colcounts =TRUE) %>%split_cols_by("ACTARM") %>%analyze_num_patients(vars ="USUBJID",count_by ="CMSEQ",.stats =c("unique", "nonunique"),.labels =c(unique ="Total number of patients with at least one treatment",nonunique ="Total number of treatments" ) ) %>%split_rows_by("ATC2",child_labels ="visible",nested =FALSE,split_fun = split_fun,label_pos ="topleft",split_label =obj_label(adcm$ATC2) ) %>%summarize_num_patients(var ="USUBJID",count_by ="CMSEQ",.stats =c("unique"),.labels =c(unique ="Total number of patients with at least one treatment" ) ) %>%count_occurrences(vars ="CMDECOD", .indent_mods =-1L) %>%append_varlabels(adcm, "CMDECOD", indent =1L)result <-build_table(lyt = lyt, df = adcm, alt_counts_df = adsl) %>%prune_table() %>%# Sort lowest level terms by descending frequency.sort_at_path(path =c("ATC2", "*", "CMDECOD"),scorefun = score_occurrences )result
ATC Level 2 Text A: Drug X B: Placebo C: Combination
Other Treatment (N=134) (N=134) (N=132)
———————————————————————————————————————————————————————————————————————————————————————————————————
Total number of patients with at least one treatment 117 (87.3%) 116 (86.6%) 116 (87.9%)
Total number of treatments 415 414 460
ATCCLAS2 A
Total number of patients with at least one treatment 75 (56.0%) 79 (59.0%) 81 (61.4%)
medname A_2/3 53 (39.6%) 50 (37.3%) 56 (42.4%)
medname A_3/3 45 (33.6%) 54 (40.3%) 48 (36.4%)
ATCCLAS2 A p2
Total number of patients with at least one treatment 45 (33.6%) 54 (40.3%) 48 (36.4%)
medname A_3/3 45 (33.6%) 54 (40.3%) 48 (36.4%)
ATCCLAS2 B
Total number of patients with at least one treatment 83 (61.9%) 74 (55.2%) 88 (66.7%)
medname B_1/4 52 (38.8%) 57 (42.5%) 59 (44.7%)
medname B_4/4 50 (37.3%) 45 (33.6%) 55 (41.7%)
ATCCLAS2 B p2
Total number of patients with at least one treatment 52 (38.8%) 57 (42.5%) 59 (44.7%)
medname B_1/4 52 (38.8%) 57 (42.5%) 59 (44.7%)
ATCCLAS2 B p3
Total number of patients with at least one treatment 52 (38.8%) 57 (42.5%) 59 (44.7%)
medname B_1/4 52 (38.8%) 57 (42.5%) 59 (44.7%)
ATCCLAS2 C
Total number of patients with at least one treatment 82 (61.2%) 84 (62.7%) 89 (67.4%)
medname C_2/2 52 (38.8%) 58 (43.3%) 60 (45.5%)
medname C_1/2 51 (38.1%) 50 (37.3%) 56 (42.4%)
ATCCLAS2 C p2
Total number of patients with at least one treatment 82 (61.2%) 84 (62.7%) 89 (67.4%)
medname C_2/2 52 (38.8%) 58 (43.3%) 60 (45.5%)
medname C_1/2 51 (38.1%) 50 (37.3%) 56 (42.4%)
ATCCLAS2 C p3
Total number of patients with at least one treatment 52 (38.8%) 58 (43.3%) 60 (45.5%)
medname C_2/2 52 (38.8%) 58 (43.3%) 60 (45.5%)
Experimental use!
WebR is a tool allowing you to run R code in the web browser. Modify the code below and click run to see the results. Alternatively, copy the code and click here to open WebR in a new tab.
Warning: `datanames<-()` was deprecated in teal.data 0.6.1.
ℹ invalid to use `datanames()<-` or `names()<-` on an object of class
`teal_data`. See ?names.teal_data
shinylive allow you to modify to run shiny application entirely in the web browser. Modify the code below and click re-run the app to see the results. The performance is slighly worse and some of the features (e.g. downloading) might not work at all.