can’t update R package documentation: `System command ‘R’ failed`

  c++, devtools, linux, r, rcpp

I have a RcppEigen project that I’m trying to update documentation for. This project only exports one c++ function into R.

Unfortunately, I get a problem when I run either devtools::document(pkg = "~/pfexamplesinr/") or roxygen2::roxygenize(roclets="rd", package.dir = "pfexamplesinr/") The error message is below.

It says something about System command 'R' failed. The last line makes mention of a class template called ConstReferenceInputParameter, so I assume it has something to do with the signature of my function. Unfortunately, I can’t figure out what the problem is. The code builds fine when I use Rcpp::sourceCpp('pfexamplesinr/src/likelihoods.cpp') The code for the particular function is below.

// [[Rcpp::export]]
double svolApproxLL(const Map<VectorXd> y, const Map<VectorXd> thetaProposal, const Map<MatrixXd> uProposal) {

  // construct particle filter object
  svol_pfilter pf(thetaProposal(0), thetaProposal(1), thetaProposal(2)); // order: phi, beta, sigma

  // iterate over the data 
  double log_like(0.0);
  Eigen::Matrix<double,1,1> yt;
  std::array<Eigen::Matrix<double,1,1>, NP> uStateTransition;
  Eigen::Matrix<double,1,1> uResample;
  for(int time = 0; time < y.rows(); ++time){
    
    // change types of inputs
    yt(0) = y(time);
    for(unsigned particle = 0; particle < NP; ++particle) {
      uStateTransition[particle] = uProposal.block(time,particle,1,1); 
    }
    uResample(0) = uProposal(time,NP);
    
    // update particle filter and log-likelihood    
    pf.filter(yt, uStateTransition, uResample);
    log_like += pf.getLogCondLike();
  }
    
  return log_like;
}
Error in (function (command = NULL, args = character(), error_on_status = TRUE,  : 
  System command 'R' failed, exit status: 1, stdout + stderr (last 10 lines):
E> /home/taylor/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/MatrixBase.h:48:34:   required from ‘class Eigen::MatrixBase<Eigen::Matrix<double, -1, 1> >’
E> /home/taylor/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/PlainObjectBase.h:98:7:   required from ‘class Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1> >’
E> /home/taylor/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/Matrix.h:178:7:   required from ‘class Eigen::Matrix<double, -1, 1>’
E> /home/taylor/R/x86_64-pc-linux-gnu-library/4.1/Rcpp/include/Rcpp/InputParameter.h:77:11:   required from ‘class Rcpp::ConstReferenceInputParameter<Eigen::Matrix<double, -1, 1> >’
E> RcppExports.cpp:43:74:   required from here
E> /home/taylor/R/x86_64-pc-linux-gnu-library/4.1/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:5

Source: Windows Questions C++

LEAVE A COMMENT