• Documentation
    • About ​ValidMind
    • Get Started
    • Guides
    • Support
    • Releases

    • ValidMind Library
    • Python API
    • Public REST API

    • Training Courses
  • Log In
  1. Install and initialize ValidMind
  2. Install and initialize the library for R
  • ValidMind Library
  • Supported records and frameworks

  • Quickstart
  • Quickstart for documentation
  • Quickstart for validation
  • Install and initialize ValidMind
    • Install and initialize the library
    • Install and initialize the library for R
    • Use an HTTP proxy with the library
  • Store credentials in .env files

  • End-to-End Tutorials
  • Development
    • 1 — Set up ValidMind Library
    • 2 — Start the development process
    • 3 — Integrate custom tests
    • 4 — Finalize testing & documentation
  • Validation
    • 1 — Set up ValidMind Library for validation
    • 2 — Start the validation process
    • 3 — Developing a challenger
    • 4 — Finalize validation & reporting

  • How-To
  • Run tests & test suites
    • Explore tests
      • Explore tests
      • Explore test suites
    • Run tests
      • Run dataset-based tests
      • Run comparison tests
      • Configuring tests
        • Configure judge LLM and judge embeddings
        • Customize test result descriptions
        • Enable PII detection in tests
        • Dataset Column Filters when Running Tests
        • Run tests with multiple datasets
        • Understand and utilize RawData in ValidMind tests
      • Using tests in documentation
        • Document multiple results for the same test
        • Run individual documentation sections
        • Run documentation tests with custom configurations
    • Custom tests
      • Implement custom tests
      • Integrate external test providers
  • Use library features
    • Data and datasets
      • Introduction to ValidMind Dataset and Model Objects
      • Dataset inputs
        • Configure dataset features
        • Load dataset predictions
    • Metrics
      • Log metrics over time
      • Intro to Unit Metrics
    • Qualitative text
      • Generate qualitative text with the ValidMind library
    • Scoring
      • Intro to Assign Scores

  • Notebooks
  • Code samples
    • Agents
      • Document an agentic AI system
    • Capital markets
      • Quickstart for knockout option pricing model documentation
      • Quickstart for Heston option pricing model using QuantLib
    • Code explainer
      • Quickstart for model code documentation
    • Credit risk
      • Document an application scorecard model
      • Document an application scorecard model
      • Document a credit risk model
      • Document an application scorecard model
      • Document an Excel-based application scorecard model
    • NLP and LLM
      • Sentiment analysis of financial data using a large language model (LLM)
      • Summarization of financial data using a large language model (LLM)
      • Sentiment analysis of financial data using Hugging Face NLP models
      • Summarization of financial data using Hugging Face NLP models
      • Automate news summarization using LLMs
      • Prompt validation for large language models (LLMs)
      • RAG Model Benchmarking Demo
      • RAG Model Documentation Demo
    • Ongoing monitoring
      • Ongoing Monitoring for Application Scorecard
      • Quickstart for ongoing monitoring of models with ValidMind
    • Regression
      • Document a California Housing Price Prediction regression model
    • Time series
      • Document a time series forecasting model
      • Document a time series forecasting model
    • Validation
      • Validate an application scorecard model

  • Reference
  • ​ValidMind test sandbox
  • ValidMind Library Python API
  • ValidMind Public REST API

On this page

  • Prerequisites
  • Install R
  • Install Python dependencies
  • Install R packages
  • Install the ValidMind R package
  • Initialize ValidMind
  • Key APIs
  • Troubleshooting
  • What's next
  • Edit this page
  • Report an issue
  1. Install and initialize ValidMind
  2. Install and initialize the library for R

Install and initialize ValidMind for R

Published

May 26, 2026

Use the ValidMind R package to document and validate records (models) built in R. The package interfaces with the ValidMind Library through reticulate, giving you access to the full Python API from R.

Prerequisites

1 Register records in the inventory

2 Working with templates

3 Manage inventory record stakeholders

Install R

Download and install R from CRAN:

  • macOS
  • Windows
  • Linux

Install via Homebrew:

brew install r

Or download the .pkg installer from CRAN.

Download and run the installer from CRAN.

On Debian/Ubuntu:

sudo apt update
sudo apt install r-base

On Fedora/RHEL:

sudo dnf install R

Install Python dependencies

Install the ValidMind Library and rpy2 so Python can interface with R records:

pip install validmind rpy2

On macOS, if rpy2 fails to find R libraries, rebuild it from source against your installed R:

R_HOME=$(Rscript -e 'cat(R.home())') pip install --no-binary :all: --force-reinstall rpy2

Install R packages

Open R and install the required packages:

install.packages(c("reticulate", "dplyr", "caTools", "knitr", "glue", "plotly", "htmltools", "rmarkdown", "DT", "base64enc"))

Install the ValidMind R package

  • From CRAN
  • From GitHub
  • From source
install.packages("validmind")
devtools::install_github("validmind/validmind-library", subdir="r/validmind")

Clone the repository and run from the r/validmind directory:

devtools::install()

Initialize ValidMind

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:

vm_r <- vm(
  api_key = "YOUR_API_KEY",
  api_secret = "YOUR_API_SECRET",
  model = "YOUR_MODEL_ID",
  python_version = "path/to/python",
  api_host = "https://API_HOST.validmind.ai/api/v1/tracking",
  document = "documentation"
)

The document parameter specifies which document type to associate with the session:

  • "documentation" — For development
  • "validation-report" — For validation

Key APIs

Since 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()

Troubleshooting

  • libc++ not found on macOS
  • Numba circular import error

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:

# Find the path to libc++.1.dylib
sudo find / -name "libc++.1.dylib" 2>/dev/null

# Create a symlink (adjust the source path based on the find result)
sudo ln -s /opt/homebrew/Cellar/llvm/.../libc++.1.dylib /Library/Frameworks/R.framework/Resources/lib/libc++.1.dylib

If you see:

ImportError: cannot import name 'NumbaTypeError' from partially initialized module 'numba.core.errors'

Reinstall Numba and restart the R session:

pip install -U numba

What's next

Quickstart for documentation

End-to-end documentation workflow in R: load data, preprocess, train a GLM model, and run the full documentation test suite.

Quickstart for validation

End-to-end validation workflow in R: load data, run data quality tests, train a champion GLM model, and run model evaluation tests.

No matching items
Install and initialize the library
Use an HTTP proxy with the library
  • ValidMind Logo
    ©
    Copyright 2026 ValidMind Inc.
    All Rights Reserved.
    Cookie preferences
    Legal
  • Get started
    • Development
    • Validation
    • Setup & admin
  • Guides
    • Access
    • Configuration
    • Integrations
    • Workflows
    • Inventory
    • Documents & templates
    • Documentation
    • Validation
    • Reporting
    • Monitoring
    • Attestation
  • ValidMind Library
    • Quickstarts
    • Development tutorial
    • Validation tutorial
    • Run tests & test suites
    • Use library features
    • Code samples
    • Python API
    • Public REST API
  • Training
    • Learning paths
    • Courses
    • Videos
  • Support
    • Troubleshooting
    • FAQ
    • Get help
  • Edit this page
  • Report an issue
  • Community
    • GitHub
    • LinkedIn
    • Events
    • Blog