1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-08 20:41:58 +02:00

(v1.8.0.9002) as.rsi() cleanup, more informative warnings

This commit is contained in:
2022-03-02 15:38:55 +01:00
parent 18e8525d10
commit 3b2b2be5f8
35 changed files with 267 additions and 320 deletions

View File

@ -95,10 +95,10 @@ age <- function(x, reference = Sys.Date(), exact = FALSE, na.rm = FALSE, ...) {
if (any(ages < 0, na.rm = TRUE)) {
ages[!is.na(ages) & ages < 0] <- NA
warning_("NAs introduced for ages below 0.", call = TRUE)
warning_("in `age()`: NAs introduced for ages below 0.")
}
if (any(ages > 120, na.rm = TRUE)) {
warning_("Some ages are above 120.", call = TRUE)
warning_("in `age()`: some ages are above 120.")
}
if (isTRUE(na.rm)) {
@ -171,7 +171,7 @@ age_groups <- function(x, split_at = c(12, 25, 55, 75), na.rm = FALSE) {
if (any(x < 0, na.rm = TRUE)) {
x[x < 0] <- NA
warning_("NAs introduced for ages below 0.", call = TRUE)
warning_("in `age_groups()`: NAs introduced for ages below 0.")
}
if (is.character(split_at)) {
split_at <- split_at[1L]