Skip to content

Commit

Permalink
make as.transform backward compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Nov 6, 2023
1 parent a590298 commit a73a3d4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions R/transform.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,18 @@ lines.transform <- function(x, ..., xlim) {
#' @rdname trans_new
#' @export
as.transform <- function(x, arg = deparse(substitute(x))) {
if (is.trans(x)) {
if (is.tranform(x)) {
x
} else if (is.character(x) && length(x) >= 1) {
if (length(x) == 1) {
f <- paste0(x, "_trans")
f <- paste0("transform_", x)
# For backward compatibility
if (!exists(f, mode = "function")) {
f2 <- paste0(x, "_trans")
if (exists(f2, mode = "function")) {
f <- f2
}
}
match.fun(f)()
} else {
transform_compose(!!!x)
Expand Down

0 comments on commit a73a3d4

Please sign in to comment.