Subsets a pima.multi object by selecting rows from its scenarios
component. The corresponding fitted models are subset accordingly, preserving
the one-to-one correspondence between scenarios$model and the names of
models.
Usage
# S3 method for class 'pima.multi'
subset(x, subset, ...)Value
A pima.multi object containing only the selected scenarios and,
when available, their corresponding fitted models.
Details
Only the scenarios and models components are subset. Components describing
the original multiverse specification, such as formula_specs and
specification, are left unchanged.
Model identifiers are not renumbered after subsetting. This preserves the original correspondence between a scenario and its fitted model.
See also
Other multiverse construction:
c.pima.multi(),
create_fit(),
create_multi()
Examples
multi <- create_multi(
Sepal.Width ~ Sepal.Length + Petal.Width,
data = iris,
nfuns = "log",
fit.specs = list(lm = lm, glm = glm)
)
# Keep only successfully fitted models
successful <- subset(multi, fit_ok)
# Inspect failed fits
failed <- subset(multi, !fit_ok)
# Keep scenarios using a particular fitting specification
lm_models <- subset(multi, fit_spec == "lm")
# Filter according to an analytical decision
log_models <- subset(
multi,
spec_Sepal.Length == "log"
)