diff --git a/R/trans-numeric.R b/R/trans-numeric.R index 9047aecd..dd718d2d 100644 --- a/R/trans-numeric.R +++ b/R/trans-numeric.R @@ -10,7 +10,8 @@ asn_trans <- function() { trans_new( "asn", function(x) 2 * asin(sqrt(x)), - function(x) sin(x / 2)^2 + function(x) sin(x / 2)^2, + domain = c(0, 1) ) } @@ -89,7 +90,7 @@ boxcox_trans <- function(p, offset = 0) { } trans_new( - paste0("pow-", format(p)), trans, inv + paste0("pow-", format(p)), trans, inv, domain = c(0, Inf) ) } @@ -246,7 +247,10 @@ log2_trans <- function() { #' @rdname log_trans #' @export log1p_trans <- function() { - trans_new("log1p", "log1p", "expm1") + trans_new( + "log1p", "log1p", "expm1", + domain = c(-1 + .Machine$double.eps, Inf) + ) } #' @rdname log_trans @@ -277,7 +281,8 @@ probability_trans <- function(distribution, ...) { trans_new( paste0("prob-", distribution), function(x) qfun(x, ...), - function(x) pfun(x, ...) + function(x) pfun(x, ...), + domain = c(0, 1) ) } #' @export