This used send a message when important column was dropped due to non-numeric data; the PR refactors the behavior to generate error; I also considered warning, but I'd rather just stop the simulation in this case
Throw error rather than message when an important column is dropped; originally aiming for parameters getting dropped, but there will also be error with a dosing column is dropped because it is non-numeric; same for 64 bit integer
Refactor recover handling in mrgsim() to defer errors for non-numeric columns that are also parameters; this lets the validate data set functions issue the error
library(mrgsolve)
#>
#> Attaching package: 'mrgsolve'
#> The following object is masked from 'package:stats':
#>
#> filter
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
mod <- house(end = 0)
data <- expand.ev(amt = 100, WTVC = "a")
mrgsim(mod, idata = data)
#> Error in `valid_idata_set()`:
#> ! Found input data that cannot be used for simulation
#> ✖ idata set column: WTVC (character)
#> Backtrace:
#> ▆
#> 1. └─mrgsolve::mrgsim(mod, idata = data)
#> 2. └─mrgsolve::mrgsim_i(x, idata = idata, ...)
#> 3. ├─base::do.call(...)
#> 4. └─mrgsolve (local) `<fn>`(x = `<packmod>`, data = `<int[,1]>`, idata = `<df[,6]>`)
#> 5. └─mrgsolve::valid_idata_set(idata, x, verbose = verbose)
#> 6. └─mrgsolve:::signal_drop(dm, x, to_signal, context = "idata set")
#> 7. └─rlang::abort(...)
mrgsim(mod, idata = data, recover = "WTVC")
#> Error in `valid_idata_set()`:
#> ! Found input data that cannot be used for simulation
#> ✖ idata set column: WTVC (character)
#> Backtrace:
#> ▆
#> 1. └─mrgsolve::mrgsim(mod, idata = data, recover = "WTVC")
#> 2. └─mrgsolve::mrgsim_i(x, idata = idata, ...)
#> 3. ├─base::do.call(...)
#> 4. └─mrgsolve (local) `<fn>`(...)
#> 5. └─mrgsolve::valid_idata_set(idata, x, verbose = verbose)
#> 6. └─mrgsolve:::signal_drop(dm, x, to_signal, context = "idata set")
#> 7. └─rlang::abort(...)
Summary
See #1184
recover
handling inmrgsim()
to defer errors for non-numeric columns that are also parameters; this lets the validate data set functions issue the errorCreated on 2024-05-21 with reprex v2.0.2