Since v0.3.0, the splines2 package provides C++ interface for constructing regression spline basis functions. This repository contains an example package that demonstrates its usage with help of Rcpp.
Firstly, in DESCRIPTION
, we need
- include
Rcpp
inImports
- include
Rcpp
,RcppArmadillo
, andsplines2 (>=0.3.0)
inLinkingTo
Secondly, we need add the following lines to a C++ script:
#include <RcppArmadillo.h>
// [[Rcpp::plugins(cpp11)]]
// include header file from splines2 package
#include <splines2Armadillo.h>
Then we have access to the routines to create spline basis functions under name
space named splines2
. For example, we may create a default B-spline object as
follows:
splines2::BSpline bs_obj;
See one of the splines2 package vignettes for more detailed introduction to the C++ interface.