Closed m7pr closed 3 months ago
✅ All contributors have signed the CLA
Posted by the CLA Assistant Lite bot.
Filename Stmts Miss Cover Missing
------------------------------- ------- ------ ------- ---------
R/g_boxplot.R 116 116 0.00% 147-310
R/g_correlationplot.R 135 135 0.00% 251-419
R/g_density_distribution_plot.R 86 86 0.00% 125-236
R/g_lineplot.R 275 275 0.00% 266-610
R/g_scatterplot.R 130 130 0.00% 142-310
R/g_spaghettiplot.R 101 101 0.00% 248-381
R/geom_axes_line.R 167 167 0.00% 46-358
R/t_summarytable.R 102 102 0.00% 87-224
R/utils.R 70 70 0.00% 17-137
TOTAL 1182 1182 0.00%
Filename Stmts Miss Cover
---------- ------- ------ --------
TOTAL 0 0 +100.00%
Results for commit: af4a33580862d9f56f4cd64e880833653ef3051a
Minimum allowed coverage is 80%
:recycle: This comment has been updated with latest results
I have read the CLA Document and I hereby sign the CLA
recheck
@m7pr
I guess the change looks okay to me but I can only test in the study data context. so if you have done testing to ensure the label changes dynamically and you'd like to merge the update then I will update my environment and test the package from https://pharmaverse.r-universe.dev
@npaszty I added the code that I used for testing in the main comment of this issue. We can test this function using all examples from ?goshawk::g_spaghettiplot
.
This fixes issue detected in Theory app on GitLab.
On legend, currently we display
metric
phrase instead ofMean
orMedian
. With this fix we display actual statistic nameTested with
```r library(stringr) # original ARM value = dose value arm_mapping <- list( "A: Drug X" = "150mg QD", "B: Placebo" = "Placebo", "C: Combination" = "Combination" ) color_manual <- c("150mg QD" = "#000000", "Placebo" = "#3498DB", "Combination" = "#E74C3C") ADLB <- rADLB var_labels <- lapply(ADLB, function(x) attributes(x)$label) ADLB <- ADLB %>% mutate(AVISITCD = case_when( AVISIT == "SCREENING" ~ "SCR", AVISIT == "BASELINE" ~ "BL", grepl("WEEK", AVISIT) ~ paste( "W", trimws( substr( AVISIT, start = 6, stop = str_locate(AVISIT, "DAY") - 1 ) ) ), TRUE ~ NA_character_ )) %>% mutate(AVISITCDN = case_when( AVISITCD == "SCR" ~ -2, AVISITCD == "BL" ~ 0, grepl("W", AVISITCD) ~ as.numeric(gsub("\\D+", "", AVISITCD)), TRUE ~ NA_real_ )) %>% # use ARMCD values to order treatment in visualization legend mutate(TRTORD = ifelse(grepl("C", ARMCD), 1, ifelse(grepl("B", ARMCD), 2, ifelse(grepl("A", ARMCD), 3, NA) ) )) %>% mutate(ARM = as.character(arm_mapping[match(ARM, names(arm_mapping))])) %>% mutate(ARM = factor(ARM) %>% reorder(TRTORD)) %>% mutate(ANRLO = .5, ANRHI = 1) %>% rowwise() %>% group_by(PARAMCD) %>% mutate(LBSTRESC = ifelse(USUBJID %in% sample(USUBJID, 1, replace = TRUE), paste("<", round(runif(1, min = .5, max = .7))), LBSTRESC )) %>% mutate(LBSTRESC = ifelse(USUBJID %in% sample(USUBJID, 1, replace = TRUE), paste(">", round(runif(1, min = .9, max = 1.2))), LBSTRESC )) %>% ungroup() attr(ADLB[["ARM"]], "label") <- var_labels[["ARM"]] attr(ADLB[["ANRLO"]], "label") <- "Analysis Normal Range Lower Limit" attr(ADLB[["ANRHI"]], "label") <- "Analysis Normal Range Upper Limit" # add LLOQ and ULOQ variables ADLB_LOQS <- goshawk:::h_identify_loq_values(ADLB, "LOQFL") ADLB <- left_join(ADLB, ADLB_LOQS, by = "PARAM") g_spaghettiplot( data = ADLB, subj_id = "USUBJID", biomarker_var = "PARAMCD", biomarker = "CRP", value_var = "AVAL", trt_group = "ARM", time = "AVISITCD", color_manual = color_manual, color_comb = "#39ff14", alpha = .02, xtick = c("BL", "W 1", "W 4"), xlabel = c("Baseline", "Week 1", "Week 4"), rotate_xlab = FALSE, group_stats = "MEAN", hline_vars = c("ANRHI", "ANRLO"), hline_vars_colors = c("pink", "brown") ) ```