Hello folks, I'm converting some R functions to RCpp at https://github.com/OVVO-Financial/NNS/
My problem is with a R "cast" function https://github.com/OVVO-Financial/NNS/blob/d3f37c6f217a41ce15b31f7a840b6b1ad63e5f36/R/Partial_Moments.R#L20 basically this line: --- LPM <- function(degree, target, variable){ if(any(class(variable)%in%c("tbl","data.table"))) variable <- as.vector(unlist(variable)) ... } --- My Rcpp version don't accept data.table type, it return an error of type not allow: Error in LPM(2, 0, tail(appended_returns, 1)) : Not compatible with requested type: [type=list; target=double]. Is there some way to accept a "anytype" at Rcpp, and convert it to numericvector when need? My Rcpp version is: https://github.com/OVVO-Financial/NNS/blob/NNS-Beta-Version/src/partial_moments_rcpp.cpp#L68 and fucntion signature is: NumericVector LPM_CPv(const double degree, const NumericVector target, const NumericVector variable) { i think i should use SEXP as "anytype" and at function body check if I should "cast" to NumericVector _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel