This is used to sanitize input for pb210_cic() and pb210_crs(), where fit objects are required but where it is anticipated that numeric constants will be common as input.

pb210_as_fit(x, ...)

# S3 method for default
pb210_as_fit(x, ...)

# S3 method for numeric
pb210_as_fit(x, ...)

pb210_fit_lazy(x)

# S3 method for `function`
pb210_as_fit(x, ...)

# S3 method for formula
pb210_as_fit(x, ...)

# S3 method for pb210_fit_lazy
pb210_as_fit(x, data = NULL, ...)

Arguments

x

An object

...

Unused.

data

For lazy fits, this object is a tibble with cumulative_dry_mass and excess.

Value

An object with a stats::predict() method.

Examples

fake_depth <- 0:10 fake_pb210 <- exp(5 - fake_depth) + rnorm(11, sd = 0.005) pb210_as_fit(pb210_fit_exponential(fake_depth, fake_pb210))
#> Nonlinear regression model #> model: y ~ exp(m * x + b) #> data: data #> b m #> 5 -1 #> residual sum-of-squares: 0.0002726 #> #> Number of iterations to convergence: 3 #> Achieved convergence tolerance: 5.184e-07
pb210_as_fit(1)
#> $coef #> b m #> 0 0 #> #> attr(,"class") #> [1] "exponential_manual"
pb210_as_fit(0)
#> $coef #> b m #> -Inf 1 #> #> attr(,"class") #> [1] "exponential_manual"