Skip to content

Commit

Permalink
update logit generation
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Dec 13, 2024
1 parent 20ea8d1 commit dc6a0b7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 54 deletions.
8 changes: 4 additions & 4 deletions R/build.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ d/dt(blood) = a*intestine - b*blood
"rxexp"="rate",
"rxchisq"="df",
"rxcauchy"=c(location = 0, scale = 1),
"rxbinom"=c("size", "prob"),
"logit"=c("x"=NA, "low"=0, "hi"=1),
"expit"=c("x"=NA, "low"=0, "hi"=1))
"rxbinom"=c("size", "prob"))
.lst2 <- .lst
names(.lst2) <- gsub("rx", "ri", names(.lst2))
.lst <- c(.lst, .lst2)
.lst <- c(.lst, .lst2,
list("logit"=c("x"=NA, "low"=0, "high"=1),
"expit"=c("x"=NA, "low"=0, "high"=1)))
paste0("# This file is generated by .generateRandomUiFuns() in build.R\n## nocov start\n",
vapply(names(.lst), function(fun) {
if (is.null(names(.lst[[fun]]))) {
Expand Down
60 changes: 10 additions & 50 deletions R/rxrandomui.R
Original file line number Diff line number Diff line change
Expand Up @@ -193,46 +193,6 @@ rxUdfUi.rxcauchy <- rxUdfUi.rxpois
#'@export
rxUdfUi.rxbinom <- rxUdfUi.rxpois

## nocov end
# This file is generated by .generateRandomUiFuns() in build.R
## nocov start
.logit <- function(x, low = 0, hi = 1) {
.x <- as.character(substitute(x))
.tmp <- suppressWarnings(try(force(x), silent = TRUE))
.x <- .uiArg(.x, .tmp)
.low <- as.character(substitute(low))
.tmp <- suppressWarnings(try(force(low), silent = TRUE))
.low <- .uiArg(.low, .tmp)
.hi <- as.character(substitute(hi))
.tmp <- suppressWarnings(try(force(hi), silent = TRUE))
.hi <- .uiArg(.hi, .tmp)
list(replace = paste0("logit(", .x, ", ", .low, ", ", .hi,
")"))
}

#'@export
rxUdfUi.logit <- rxUdfUi.rxpois

## nocov end
# This file is generated by .generateRandomUiFuns() in build.R
## nocov start
.expit <- function(x, low = 0, hi = 1) {
.x <- as.character(substitute(x))
.tmp <- suppressWarnings(try(force(x), silent = TRUE))
.x <- .uiArg(.x, .tmp)
.low <- as.character(substitute(low))
.tmp <- suppressWarnings(try(force(low), silent = TRUE))
.low <- .uiArg(.low, .tmp)
.hi <- as.character(substitute(hi))
.tmp <- suppressWarnings(try(force(hi), silent = TRUE))
.hi <- .uiArg(.hi, .tmp)
list(replace = paste0("expit(", .x, ", ", .low, ", ", .hi,
")"))
}

#'@export
rxUdfUi.expit <- rxUdfUi.rxpois

## nocov end
# This file is generated by .generateRandomUiFuns() in build.R
## nocov start
Expand Down Expand Up @@ -432,17 +392,17 @@ rxUdfUi.ribinom <- rxUdfUi.rxpois
## nocov end
# This file is generated by .generateRandomUiFuns() in build.R
## nocov start
.logit <- function(x, low = 0, hi = 1) {
.logit <- function(x, low = 0, high = 1) {
.x <- as.character(substitute(x))
.tmp <- suppressWarnings(try(force(x), silent = TRUE))
.x <- .uiArg(.x, .tmp)
.low <- as.character(substitute(low))
.tmp <- suppressWarnings(try(force(low), silent = TRUE))
.low <- .uiArg(.low, .tmp)
.hi <- as.character(substitute(hi))
.tmp <- suppressWarnings(try(force(hi), silent = TRUE))
.hi <- .uiArg(.hi, .tmp)
list(replace = paste0("logit(", .x, ", ", .low, ", ", .hi,
.high <- as.character(substitute(high))
.tmp <- suppressWarnings(try(force(high), silent = TRUE))
.high <- .uiArg(.high, .tmp)
list(replace = paste0("logit(", .x, ", ", .low, ", ", .high,
")"))
}

Expand All @@ -452,17 +412,17 @@ rxUdfUi.logit <- rxUdfUi.rxpois
## nocov end
# This file is generated by .generateRandomUiFuns() in build.R
## nocov start
.expit <- function(x, low = 0, hi = 1) {
.expit <- function(x, low = 0, high = 1) {
.x <- as.character(substitute(x))
.tmp <- suppressWarnings(try(force(x), silent = TRUE))
.x <- .uiArg(.x, .tmp)
.low <- as.character(substitute(low))
.tmp <- suppressWarnings(try(force(low), silent = TRUE))
.low <- .uiArg(.low, .tmp)
.hi <- as.character(substitute(hi))
.tmp <- suppressWarnings(try(force(hi), silent = TRUE))
.hi <- .uiArg(.hi, .tmp)
list(replace = paste0("expit(", .x, ", ", .low, ", ", .hi,
.high <- as.character(substitute(high))
.tmp <- suppressWarnings(try(force(high), silent = TRUE))
.high <- .uiArg(.high, .tmp)
list(replace = paste0("expit(", .x, ", ", .low, ", ", .high,
")"))
}

Expand Down

0 comments on commit dc6a0b7

Please sign in to comment.