Skip to contents

This function inspects the package's internal environment and returns the names of all predefined model objects that inherit from the rctbp_model class. These models are prebuilt and stored internally in the package via sysdata.rda and are not exported to users directly. This function allows discovery of available predefined models programmatically.

Usage

list_predefined_models(filter_string = NULL)

Arguments

filter_string

Optional character string for filtering model names. If provided, only models whose names match this pattern (via base::grepl()) will be returned. Use this to find specific types of models (e.g., "ancova").

Value

A character vector of object names corresponding to predefined models. Returns an empty character vector if no models are found or if the filter excludes all available models.

Details

The returned model names can be used directly with build_model() by passing them to the predefined_model parameter:

model <- build_model(predefined_model = "model_name")

This provides a convenient way to discover and use prebuilt models without needing to specify all model parameters manually.

Examples

# List all available predefined models
list_predefined_models()
#> [1] "ancova_cont_2arms" "ancova_cont_3arms"

# Filter for ANCOVA models only
list_predefined_models(filter_string = "ancova")
#> [1] "ancova_cont_2arms" "ancova_cont_3arms"

# Use discovered model with build_model()
available_models <- list_predefined_models()
if (length(available_models) > 0) {
  model <- build_model(predefined_model = available_models[1])
}