#include <RcppArmadillo.h> // [[Rcpp::depends(RcppArmadillo)]] using namespace Rcpp; // [[Rcpp::export]] arma::mat fed(arma::mat x){ arma::mat zz=x.shed_rows(0,2); return(zz); }
只是想从矩阵中删除一些行,得到如下错误。 已请求从“void”转换为非标量类型“arma::Mat}”
两点:
shed_rows()
以下工作:
#include <RcppArmadillo.h> // [[Rcpp::depends(RcppArmadillo)]] using namespace Rcpp; // [[Rcpp::export]] arma::mat fed(arma::mat x){ x.shed_rows(0,2); return(x); } /*** R fed(matrix(1:16, 4 ,4)) */