Installation

rbartpackages drives R packages through rpy2, so you need both a Python and an R installation.

Python package

pip install rbartpackages

(Or the equivalent for your package manager, e.g. uv add rbartpackages.) To install the latest development version:

pip install git+https://github.com/bartz-org/rbartpackages.git

The wrappers that return a data frame return a pandas one by default. If polars[pyarrow] is installed, output dataframes switch to polars. If jax is installed, jax arrays are accepted as input arrays, but output arrays remain numpy. Two extras are provided for convenience to install these packages alongside rbartpackages:

pip install 'rbartpackages[polars,jax]'

R packages

Install R, then install the latest version of the wrapped packages you intend to use. Older versions are not supported but may work anyway. BART, dbarts and bartMachine are on CRAN; BART3 and missBART live on GitHub:

install.packages(c("BART", "dbarts", "bartMachine"))
install.packages("remotes")
remotes::install_github("rsparapa/bnptools/BART3")
remotes::install_github("yongchengoh/missBART")

bartMachine is a Java package and additionally requires a working Java toolchain and rJava (run R CMD javareconf after installing a JDK).

Even just importing a wrapper (e.g. from rbartpackages import BART3) requires the matching R package to be installed, because the class docstrings are pulled from the R documentation at import time.