0

I've following R Code

tXPM <- function(x) {
.Call(tXPMCpp, x)

} and following RCPP code

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));}

When i call this function by passing it datamatrix it shows following error:

  1. Error in .Call(tXPMCpp, x) : first argument must be a string (of length 1) or native symbol reference

How can i call this function?

  • 2
    Welcome to StackOverflow, and congrats on your first question. Allow me to suggest you spend a little bit of time with _e.g._ the [Rcpp Introduction](https://cloud.r-project.org/web/packages/Rcpp/vignettes/Rcpp-introduction.pdf) vignette because you appear a little confused: With Rcpp you never call `.Call()` directly. See the vignette and its example, see maybe package [RcppExamples](http://cloud.r-project.org/package=RcppExamples) or the [Rcpp Gallery](https://gallery.rcpp.org/) with its 100+ examples. – Dirk Eddelbuettel Aug 02 '20 at 20:58
  • @DirkEddelbuettel I'm using existing code that is published on GitHub https://github.com/kenshunyip/Linnorm.git – Fahid Ahmad Aug 03 '20 at 20:01
  • Being on github is not a sufficient condition for being correct as far as code (or anything else, really) is concerned. – Dirk Eddelbuettel Aug 03 '20 at 20:11
  • Moreover, you are looking at possibly _stale_ code. The current version of the BioConductor package `Linnorm` appears here: https://bioconductor.org/packages/release/bioc/html/Linnorm.html – Dirk Eddelbuettel Aug 03 '20 at 20:12

0 Answers0