Skip to content

Commit

Permalink
FT: #59 use switch in fetch_mms_emoji_title
Browse files Browse the repository at this point in the history
  • Loading branch information
ricfog committed Mar 29, 2021
1 parent ca37131 commit 385e9ad
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions R/ols-summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -201,34 +201,36 @@ get_mms_rnm_cols_suff <- function(var_summary, var_type_abb) {
#' # TODO: Add here
#' }
fetch_mms_emoji_title <- function(var_type_abb, title_type) {


# Get the title only for the specific variance type
var_title <- dplyr::case_when(
var_type_abb == "lm" ~ "Well Specified Model",
var_type_abb == "sand" ~ "Sandwich",
var_type_abb == "emp" ~ "Empirical Bootstrap",
var_type_abb == "res" ~ "Residual Bootstrap",
var_type_abb == "mul" ~ "Multiplier Bootstrap"
var_title <- switch(var_type_abb,
"lm" = "Well Specified Model",
"sand" = "Sandwich",
"emp" = "Empirical Bootstrap",
"res" = "Residual Bootstrap",
"mul" = "Multiplier Bootstrap"
) %>%
glue::as_glue(x = .)

# Get the emoji only for the specific variance type
var_emoji <- dplyr::case_when(
var_type_abb == "lm" ~ "\U1F4C9\U1F4C8",
var_type_abb == "sand" ~ "\U1F969\U1F35E", # \U1F96A
var_type_abb == "emp" ~ "\U1F9EE\U1F45F",
var_type_abb == "res" ~ "\U2696\U1F45F",
var_type_abb == "mul" ~ "\U274C\U1F45F" # \U2716
var_emoji <- switch(var_type_abb,
"lm" = "\U1F4C9\U1F4C8",
"sand" = "\U1F969\U1F35E", # \U1F96A
"emp" = "\U1F9EE\U1F45F",
"res" = "\U2696\U1F45F",
"mul" = "\U274C\U1F45F" # \U2716
) %>%
glue::as_glue(x = .)

# Get the combined emoji: title for the specific variance type
var_emoji_title <- glue::glue("{var_emoji}: {var_title}:")

# Get the specific string type based on user specification
out <- dplyr::case_when(
title_type == "title" ~ var_title,
title_type == "emoji" ~ var_emoji,
title_type == "emoji_title" ~ var_emoji_title
out <- switch(title_type,
"title" = var_title,
"emoji" = var_emoji,
"emoji_title" = var_emoji_title
)
return(out)
}
Expand Down

0 comments on commit 385e9ad

Please sign in to comment.