Learn R Programming

rcppmlpackexamples: Example of using mlpack via its C++ API from R

About

mlpack has supported header-only compilation since the 4.0.0 release. It also contains an R package that has been part of CRAN for years. Its focus is on access from R at the R prompt: underlying mlpack functions are properly wrapped.

Sometimes, however, we would like to access the C++ API of mlpack from the C++ side of an R package. This package provides a working demonstration of how to do this.

Scope

Currently, the package contains two examples covering

  • linear regression (with optional regularization)
  • random forest classification of a multinomial response
  • loan default prediction using a decision tree

Installation

For now the package is available only at GitHub so please rely on remotes::install_github():

> remotes::install_github("eddelbuettel/rcppmlpack-examples")

Miscellaneous

We use the rcpp prefix to not conflate this repo with the existing mlpack examples repo.

Author

Dirk Eddelbuettel for this R package

The mlpack authors for all of mlpack

License

GPL (>= 2) for this package

MIT for mlpack

Copy Link

Version

Install

install.packages('rcppmlpackexamples')

Monthly Downloads

126

Version

0.0.1

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Dirk Eddelbuettel

Last Published

September 21st, 2025

Functions in rcppmlpackexamples (0.0.1)

covertype_small

Covertype data subset used for classification
loanDefaultPrediction

loanDefaultPrediction
randomForest

Run a Random Forest classificatio
kMeans

Run a k-means clustering analysis
linearRegression

Run a linear regression with optional ridge regression
rcppmlpackexamples-package

tools:::Rd_package_title("rcppmlpackexamples")
loanData

Loan data subset used for default prediction