R/age_depth_model.R
as_trans_factory.Rd
Coerce and validate transforms and functions that produce them
as_trans_factory(factory, env = parent.frame())
validate_trans_factory(factory, x = 1:3, y = 1:3)
validate_trans(trans, x = 1:3, y = 1:3)
A function that produces a transform object
The calling environment, for transform factories that are calls or rlang lambda-style functions.
The test x data
The test y data
A transform object
The input, invisibly.
as_trans_factory(age_depth_interpolate)
#> function (x, y)
#> {
#> if (!all(is.finite(c(x, y))))
#> stop("Non-finite values in transformation")
#> verify_length(x, y)
#> force(x)
#> force(y)
#> list(trans = function(new_x) {
#> stats::approx(x, y, xout = new_x)$y
#> }, inverse = function(new_y) {
#> stats::approx(y, x, xout = new_y)$y
#> })
#> }
#> <bytecode: 0x55fd97194848>
#> <environment: namespace:tidypaleo>