convert Rcpp::CharacterVector to std::string

前端 未结 2 1311
既然无缘
既然无缘 2020-12-14 08:07

I am trying to open a file within an Rcpp function, so I need the file name as a char* or std::string.

So far, I have tried the following:

#include &         


        
2条回答
  •  情深已故
    2020-12-14 08:41

    Rcpp::as() expects a SEXP as input, not a Rcpp::CharacterVector. Try passing the f1 parameter directly to Rcpp::as(), eg:

    std::string fname = Rcpp::as(f1); 
    

    Or:

    std::string fname = Rcpp::as(f1); 
    

提交回复
热议问题