Quickstart for model documentation
End-to-end model documentation workflow in R: load data, preprocess, train a GLM model, and run the full documentation test suite.
March 25, 2026
Use the ValidMind R package to document and validate models built in R. The package interfaces with the ValidMind Library through reticulate, giving you access to the full Python API from R.
Download and install R from CRAN:
Install the ValidMind Library and rpy2 so Python can interface with R models:
Open R and install the required packages:
Connect to your ValidMind profile by providing your credentials. Point python_version to your Python binary — for example, the one in your project's .venv:
The document parameter specifies which document type to associate with the session:
"documentation" — For model development"validation-report" — For model validationSince the R package returns the full Python validmind module, you can call any Python API directly via reticulate:
# Preview the documentation template
vm_r$preview_template()
# Initialize datasets
vm_dataset <- vm_r$init_dataset(
dataset = df,
input_id = "my_dataset",
target_column = "target"
)
# Initialize R models
model_path <- save_model(model)
vm_model <- vm_r$init_r_model(model_path = model_path, input_id = "model")
# Assign predictions
vm_dataset$assign_predictions(model = vm_model)
# Run the full documentation test suite
vm_r$run_documentation_tests(config = test_config)
# Run individual tests
vm_r$tests$run_test(
"validmind.data_validation.ClassImbalance",
inputs = list(dataset = vm_dataset)
)$log()
# List available tests
vm_r$tests$list_tests(tags = list("data_quality"), task = "classification")
vm_r$tests$list_tasks_and_tags()When calling vm() you may see an error like:
OSError: dlopen(...libllvmlite.dylib...): Library not loaded: @rpath/libc++.1.dylib
This typically means the libc++ library is installed but R cannot find it. Create a symlink: