result <-basic_table() %>%split_cols_by("ARM") %>%split_cols_by("AVISIT") %>%split_rows_by("TBILI_CAT") %>%# below split helps us get the right denominator between ALT/AST but it can be hiddensplit_rows_by("ALTAST_ind", split_fun =trim_levels_to_map(map), child_labels ="hidden") %>%count_occurrences(vars ="ALTAST_CAT",.stats ="fraction",denom ="n",drop =FALSE ) %>%append_topleft("Liver Laboratory Test Criterion") %>%build_table(df = adhy_liver)# trim away rows with criteria not metcriteria_fun <-function(tr) { row_label <-obj_label(tr)ifelse(row_label =="Criteria not met", TRUE, FALSE)}result <- result %>%trim_rows(criteria = criteria_fun)result
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.
result <-basic_table() %>%split_cols_by("ARM") %>%split_cols_by("AVISIT") %>%split_rows_by("TBILI_CAT",split_fun =remove_split_levels("Total Bilirubin > 2xULN and Alkaline Phosphatase <= 2xULN") ) %>%# below split helps us get the right denominator between ALT/AST but it can be hiddensplit_rows_by("ALTAST_ind",split_fun =trim_levels_to_map(map), child_labels ="hidden" ) %>%count_occurrences(vars ="ALTAST_CAT",.stats ="fraction",denom ="n",drop =FALSE ) %>%append_topleft("Liver Laboratory Test Criterion") %>%build_table(df = adhy_liver)# trim away rows with criteria not metcriteria_fun <-function(tr) { row_label <-obj_label(tr)ifelse(row_label =="Criteria not met", TRUE, FALSE)}result <- result %>%trim_rows(criteria = criteria_fun)result
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.