Avoid rounding NAs in annotation labels
This commit is contained in:
@@ -382,7 +382,7 @@ calculate_interaction_scores <- function(df, max_conc, variables, group_vars = c
|
|||||||
|
|
||||||
generate_and_save_plots <- function(output_dir, file_name, plot_configs, grid_layout = NULL) {
|
generate_and_save_plots <- function(output_dir, file_name, plot_configs, grid_layout = NULL) {
|
||||||
|
|
||||||
message("Generating html and pdf plots for: ", file_name, ".pdf|html")
|
message("Generating html and pdf plots for: ", file_name)
|
||||||
|
|
||||||
plots <- lapply(plot_configs, function(config) {
|
plots <- lapply(plot_configs, function(config) {
|
||||||
df <- config$df
|
df <- config$df
|
||||||
@@ -554,8 +554,22 @@ generate_interaction_plot_configs <- function(df, variables) {
|
|||||||
|
|
||||||
# Define which annotations to include for each plot
|
# Define which annotations to include for each plot
|
||||||
annotation_labels <- list(
|
annotation_labels <- list(
|
||||||
ZShift = function(df, var) paste("ZShift =", round(df[[paste0("Z_Shift_", var)]], 2)),
|
ZShift = function(df, var) {
|
||||||
lm_ZScore = function(df, var) paste("lm ZScore =", round(df[[paste0("Z_lm_", var)]], 2)),
|
val <- df[[paste0("Z_Shift_", var)]]
|
||||||
|
if (is.numeric(val)) {
|
||||||
|
paste("ZShift =", round(val, 2))
|
||||||
|
} else {
|
||||||
|
paste("ZShift =", val)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lm_ZScore = function(df, var) {
|
||||||
|
val <- df[[paste0("Z_lm_", var)]]
|
||||||
|
if (is.numeric(val)) {
|
||||||
|
paste("lm ZScore =", round(val, 2))
|
||||||
|
} else {
|
||||||
|
paste("lm ZScore =", val)
|
||||||
|
}
|
||||||
|
},
|
||||||
NG = function(df, var) paste("NG =", df$NG),
|
NG = function(df, var) paste("NG =", df$NG),
|
||||||
DB = function(df, var) paste("DB =", df$DB),
|
DB = function(df, var) paste("DB =", df$DB),
|
||||||
SM = function(df, var) paste("SM =", df$SM)
|
SM = function(df, var) paste("SM =", df$SM)
|
||||||
|
|||||||
Reference in New Issue
Block a user