Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report domains for several transformations #394

Merged
merged 3 commits into from
Nov 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions R/trans-numeric.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
}

Expand Down Expand Up @@ -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)
)
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading