I am trying to remove some columns from an arma::mat object using Armadillo. It seems like .shed_col() is the perfect way to do that (see e.g. here).
However, the following code does not compile:
#include <RcppArmadillo.h>
#include <Rcpp.h>
// [[Rcpp::depends(RcppArmadillo)]]
using namespace Rcpp;
// [[Rcpp::export]]
arma::mat test(arma::mat x){
arma::mat y = x.shed_col(0);
return(y);
}
The line where y pops up for the first time returns:
conversion from 'void' to non-scalar type 'arma::mat {aka arma::mat<double>}' requested
It seems that the reason is that a function involved in here returns void while I want arma::mat to be returned. Is that correct? Any fixes for that? Thanks!