#' @title Compute Scale Values for Main Effects Plot
#' @description
#' @param df A wide-tibble containing data for each input parameter
#' @param ip Input-Parameter: a vector of strings containing the column names that are designated as input parameters by the user
#' @param op Output-Parameter: a single string designating the column name of the output parameter which should be numeric
#' @return A vector containing the rounded max/min mean of the specified output parameter across input parameter groups.
#' @importFrom tidyr gather
#' @importFrom dplyr %>% group_by summarise
compute_scale_vals <- function(df, ip, op){
if(!is.symbol(op)){
op <- sym(op)
}
suppressWarnings(df %>%
gather(key = "input_param", value = "input_cat", ip) %>%
group_by(.$input_param, .$input_cat) %>%
summarise(mean = mean(!!op)) %>%
{c((min(.$mean)) ,(max(.$mean)))} %>%
{if (diff(.) <= 1)
round(., digits = 3)
else
round(., digits = 0)
})
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.