我一直在关注 R 代码
tXPM <- function(x) {
.Call(tXPMCpp, x)
并遵循 RCPP 代码
SEXP tXPMCpp (SEXP xSEXP){
arma::mat GeneExp = Rcpp::as<arma::mat>(xSEXP);
arma::rowvec ColumnSums = sum(GeneExp, 0);
int_fast32_t i=0, n=0;
arma::mat::iterator it_end = GeneExp.end();
//One pass linear regression with one pass variance, skewness
for (arma::mat::iterator it = GeneExp.begin(); it != it_end; ++it) {
//std::cout << (*it) << std::endl;
*it = *it/ColumnSums.at(i);
n++;
if (n == int(GeneExp.n_rows)) {
n=0;
i++;
}
}
return Rcpp::wrap(trans(GeneExp));}
当我通过传递数据矩阵调用此函数时,它显示以下错误:
- .Call(tXPMCpp, x) 中的错误:第一个参数必须是字符串(长度为 1)或本机符号引用
我怎样才能调用这个函数?