From e733cbc1cd6cf81b7f39856795b6640a8083a5ff Mon Sep 17 00:00:00 2001 From: Karishma Srikanth <84093378+karishmas26@users.noreply.github.com> Date: Mon, 6 May 2024 15:53:29 -0400 Subject: [PATCH] change `cat()` to `cli_inform()` to return printed text as message, addresses #32 --- R/fetch_indicators.R | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/R/fetch_indicators.R b/R/fetch_indicators.R index 6bc71dc..8e0607d 100644 --- a/R/fetch_indicators.R +++ b/R/fetch_indicators.R @@ -21,7 +21,9 @@ fetch_indicators <- function(df, tab = "main") { pd <- df %>% gophr::identifypd() %>% stringr::str_extract(".{2}$") - cat("Fetching ", crayon::yellow(pd), " indicators\n") + + #cat("Fetching ", crayon::yellow(pd), " indicators\n") + cli::cli_inform(glue::glue("Fetching {crayon::yellow(pd)} indicators\n")) if(!tab %in% c("main", "treatment")) { stop("Please select the indicator crosswalk you would like to use: main or treatment") @@ -41,7 +43,10 @@ fetch_indicators <- function(df, tab = "main") { } else { indics <- indic_list } - cat(crayon::yellow(pd), " indicators fetched ", crayon::yellow(indics$indicator), "\n") + + #concatenate indicator list into a chracter for return message + lst <- paste(indics$indicator, collapse = ", ") + cli::cli_inform(glue::glue("{crayon::yellow(pd)} indicators fetched {crayon::yellow(lst)} \n")) return(indics) } \ No newline at end of file