Skip to content

Commit

Permalink
monsternr fix
Browse files Browse the repository at this point in the history
  • Loading branch information
msberends committed Jun 24, 2024
1 parent ed35dc1 commit b9cacae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: certetoolbox
Title: A Certe R Package for Miscellaneous Functions
Version: 1.13.2
Version: 1.13.3
Authors@R: c(
person(given = c("Erwin", "E.", "A."),
family = "Hassing",
Expand Down
13 changes: 10 additions & 3 deletions R/data.frame.R
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,8 @@ auto_transform <- function(x,
return(x)
}

col_names.bak <- colnames(x)

if (isTRUE(snake_case)) {
x <- format_names(x, snake_case = TRUE)
}
Expand Down Expand Up @@ -1258,10 +1260,10 @@ auto_transform <- function(x,

if ("AMR" %in% rownames(utils::installed.packages())) {
# check for SIR
if (col_name %like% "_(rsi|sir)$" ||
if (col_name %like% "_(rsi|sir)$" || col_names.bak[i] %like_case% "^[A-Z]{3}$" ||
(inherits(col_data, c("factor", "character")) &&
!all(col_data_unique[!is.na(col_data_unique)] == "") &&
all(col_data_unique[!is.na(col_data_unique)] %in% c("", "I", "I;I", "R", "R;R", "S", "S;S")))) {
!all(col_data_unique[!is.na(col_data_unique)] %in% c("", "-")) &&
all(col_data_unique[!is.na(col_data_unique)] %in% c("", "I", "I;I", "R", "R;R", "S", "S;S", "-")))) {
x[, i] <- try_convert(AMR::as.sir(col_data),
backup = x[, i, drop = TRUE], col = i)
}
Expand All @@ -1276,6 +1278,11 @@ auto_transform <- function(x,
backup = x[, i, drop = TRUE], col = i)
}
}

if (col_name %like% "(monster|order)(nummer|nr)") {
x[, i] <- as.character(col_data)
}

}
x
}
Expand Down

0 comments on commit b9cacae

Please sign in to comment.