Skip to content

Commit

Permalink
Change cli_warn() to cli_alert_warning()
Browse files Browse the repository at this point in the history
  • Loading branch information
krauwe committed Feb 6, 2024
1 parent d2744d9 commit bfdb7c5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
10 changes: 5 additions & 5 deletions R/classify_nuts.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ classify_nuts <-
# CLASSIFICATION POSSIBLE
#-------------------------
# Welcome information
cli_alert_info(c("{.blue Classifying version of NUTS codes}",
"\n{.blue -----------------------------------}"))
cli_text("{.blue Classifying version of NUTS codes}")
cli_text("{.blue -----------------------------------}")
# Check for NUTS codes that cannot be classified
all_nuts_codes <- get("all_nuts_codes")
codes_not_found <-
Expand Down Expand Up @@ -218,8 +218,8 @@ classify_nuts <-
# - Check if there is variation within groups
pct_overlap_within_groups <- unique(data$overlap_perc[!is.na(data$from_version)])
if (any(pct_overlap_within_groups < 100)) {
cli_warn(c( "{.blue => Within {.red groups} defined by {.red {group_vars}}.}",
"{.blue ==> {.red Multiple} NUTS versions classified. See the tibble 'versions_data' in the output.}"))
cli_alert_info("{.blue => Within {.red groups} defined by {.red {group_vars}}.}")
cli_alert_warning("{.blue ==> {.red Multiple} NUTS versions classified. See the tibble 'versions_data' in the output.}")
paste_grouping <- F
} else {
paste_grouping <- T
Expand Down Expand Up @@ -286,7 +286,7 @@ classify_nuts <-
if (nrow(data_missing_nuts) == 0) {
cli_alert_info("{.blue \n==> No missing NUTS codes.}")
} else if (nrow(data_missing_nuts) > 0) {
cli_alert_info("{.blue \n==> {.red Missing} NUTS codes detected. See the tibble 'missing_data' in the output.}")
cli_alert_warning("{.blue \n==> {.red Missing} NUTS codes detected. See the tibble 'missing_data' in the output.}")
}
# - done

Expand Down
12 changes: 6 additions & 6 deletions R/convert_nuts_level.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ convert_nuts_level <-
# CONVERSION POSSIBLE
#----------------------
# Welcome information
cli_alert_info(c("{.blue Converting level of NUTS codes}",
"\n{.blue --------------------------------}"))
cli_text("{.blue Converting level of NUTS codes}")
cli_text("{.blue ------------------------------}")
# CONVERSION BETWEEN DIFFERENT NUTS LEVELS
cli_alert_info("{.blue => Aggregate from NUTS regional level {.red {data$from_level[1]}} to {.red {to_level}}}.")

Expand All @@ -126,7 +126,7 @@ convert_nuts_level <-
cli_alert_info("{.blue => All NUTS codes can be converted.}")
} else if (nr_nuts_codes_recognized < nr_nuts_codes &&
nr_nuts_codes_recognized > 0) {
cli_warn("{.blue => These NUTS codes cannot be converted and {.red are dropped} from the dataaset: {.red {unique(data$from_code[!check_nuts_codes])}}.}")
cli_alert_warning("{.blue => These NUTS codes cannot be converted and {.red are dropped} from the dataset: {.red {unique(data$from_code[!check_nuts_codes])}}.}")
data <- data[check_nuts_codes, ]
}

Expand All @@ -144,7 +144,7 @@ convert_nuts_level <-
# Use data_versions which is sorted for most frequent version within group
if (multi_versions_A > multi_versions_B) {
cli_alert_info("{.blue => Within {.red groups} defined by {.red {group_vars}}}")
cli_warn("{.blue ==> {.red Multiple} NUTS code versions.}")
cli_alert_warning("{.blue ==> {.red Multiple} NUTS code versions.}")

if (multiple_versions == "break") {
cli_abort(
Expand Down Expand Up @@ -219,8 +219,8 @@ convert_nuts_level <-
}

if (nrow(missing) > 0) {
cli_warn(c("{.blue => {.red Missing} NUTS codes in data.}",
"{.blue ==> No values are calculated for regions associated with missing NUTS codes. Ensure that the input data is complete.}"))
cli_alert_warning("{.blue => {.red Missing} NUTS codes in data.}")
cli_alert_warning("{.blue ==> No values are calculated for regions associated with missing NUTS codes. Ensure that the input data is complete.}")
} else if (nrow(missing) == 0) {
cli_alert_info("{.blue => No missing NUTS codes.}")
}
Expand Down
11 changes: 6 additions & 5 deletions R/convert_nuts_version.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ convert_nuts_version <-
# CONVERSION POSSIBLE
#----------------------
# Welcome information
cli_alert_info(c("{.blue Converting versions of NUTS codes}",
"\n{.blue -----------------------------------}"))
cli_text("{.blue Converting versions of NUTS codes}")
cli_text("{.blue ---------------------------------}")
# CONVERSION BETWEEN DIFFERENT NUTS VERSIONS
cli_alert_info("{.blue => Converting NUTS codes in version(s) {.red {unique(data$from_version[!is.na(data$from_version)])}} to version {.red {to_version}}.}")
# Check which NUTS codes can be converted
Expand All @@ -130,7 +130,7 @@ convert_nuts_version <-
cli_alert_info("{.blue All NUTS codes can be converted.}")
} else if (nr_nuts_codes_recognized < nr_nuts_codes &&
nr_nuts_codes_recognized > 0) {
cli_warn("{.blue => These NUTS codes cannot be converted and {.red are dropped} from the dataaset: {.red {unique(data$from_code[!check_nuts_codes])}}.}")
cli_alert_warning("{.blue => These NUTS codes cannot be converted and {.red are dropped} from the dataaset: {.red {unique(data$from_code[!check_nuts_codes])}}.}")
data <- data[check_nuts_codes, ]
}

Expand All @@ -148,7 +148,7 @@ convert_nuts_version <-
# Use data_versions which is sorted for most frequent version within group
if (multi_versions_A > multi_versions_B) {
cli_alert_info("{.blue => Within {.red groups} defined by {.red {group_vars}}}")
cli_warn("{.blue ==> {.red Multiple} NUTS code versions.}")
cli_alert_warning("{.blue ==> {.red Multiple} NUTS code versions.}")
if (multiple_versions == "break") {
cli_abort(
c(
Expand Down Expand Up @@ -228,7 +228,8 @@ convert_nuts_version <-

# - Alert missing
if (nrow(missing) > 0) {
cli_warn( "{.blue ==> {.red Missing} NUTS codes in data. No values are calculated for regions associated with missing NUTS codes. Ensure that the input data is complete.}" )
cli_alert_warning("{.blue => {.red Missing} NUTS codes in data.}")
cli_alert_warning("{.blue ==> No values are calculated for regions associated with missing NUTS codes. Ensure that the input data is complete.}")
} else if (nrow(missing) == 0) {
cli_alert_info("{.blue \n==> No missing NUTS codes.}")
}
Expand Down

0 comments on commit bfdb7c5

Please sign in to comment.