Skip to content

Commit

Permalink
changed cat() to message() where appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
samumei committed Apr 30, 2024
1 parent 9de1d70 commit 9979344
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion R/GU_normalization.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ GU_normalization <- function(formula, data, weights, group) {
if (sum(attr(function_terms, "order")) > length(attr(function_terms, "order"))) {
stop("GU normalization does not allow interactions.")
}
cat("\nFactor variables are normalized as proposed by Gardeazabal & Ugidos (2004)\n")
message("\nFactor variables are normalized as proposed by Gardeazabal & Ugidos (2004)\n")

term_labels <- attr(function_terms, "term.labels")

Expand Down
6 changes: 2 additions & 4 deletions R/dfl_decompose.R
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,7 @@ dfl_decompose <- function(formula,
statistics_not_implemented <- setdiff(statistics, statistics_implemented)
statistics <- setdiff(statistics, statistics_not_implemented)
if (length(statistics_not_implemented) > 0) {
cat("Warning:", paste0("Selected statistics (", paste0(statistics_not_implemented, collapse = ", "), ")"), "not implemented! \n")
cat("Implemented statistics:", paste0(statistics_implemented, collapse = ", "), "\n \n")
warning(paste0("Selected statistics (", paste0(statistics_not_implemented, collapse = ", "), ")", "not implemented! \n\nImplemented statistics:", paste0(statistics_implemented, collapse = ", "), "\n \n"))
}
if ("quantiles" %in% statistics & length(probs) == 0) {
probs <- seq(5, 95, 5) / 100
Expand Down Expand Up @@ -487,9 +486,8 @@ dfl_decompose <- function(formula,
...
)


if (bootstrap) {
cat("Bootstrapping standard errors...\n")
message("Bootstrapping standard errors...\n")
if (cores == 1) {
bootstrap_estimates <- pbapply::pblapply(
1:bootstrap_iterations,
Expand Down
4 changes: 2 additions & 2 deletions R/ob_decompose.R
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ ob_decompose <- function(formula,
nvar <- length(formula)[2] # Number of detailed decomposition effects
if (nvar == 1) {
if (reweighting) {
cat("\n\nThe same model specification is used in the linear decomposition model and\nin the conditional probability model used to compute the reweighting factors.")
message("\n\nThe same model specification is used in the linear decomposition model and\nin the conditional probability model used to compute the reweighting factors.")
}
formula_decomposition <- formula
formula_reweighting <- formula
Expand Down Expand Up @@ -481,7 +481,7 @@ ob_decompose <- function(formula,
data_used$cluster_weights <- cluster_weights[match(as.character(cluster), rownames(cluster_weights)), ]
}

cat("\nBootstrapping standard errors...\n")
message("\nBootstrapping standard errors...\n")

if (cores == 1) {
bootstrap_estimates <- pbapply::pblapply(
Expand Down

0 comments on commit 9979344

Please sign in to comment.