Hi there, I would like to call discpartarea() and as.owin() functions of spatstat from Rcpp. In a simple example consider the following C++ code in which I'm trying to access the above functions:
#include <Rcpp.h> using namespace Rcpp; // [[Rcpp::export]] NumericVector IndepSelfCortCpp( NumericMatrix obsu) { NumericMatrix obsxy = obsu( _ , Range(1,2) ) ; NumericVector xyW= NumericVector::create(0,56,0,38); double rslt = 0; rslt= spatstat::discpartarea(obsxy, 0.1, spatstat::as.owin(xyW)); return (rslt); } /* ** R obsu <- matrix(c(0.5, 1.5, 4, 12, 1,2,3,4,2,3,5,7), ncol=3) IndepSelfCortCpp(obsu) */ When I source the file in Rstudio with sourceCpp(), I get the error:" 'spatstat' has not been declard " I was wondering, a direct call a function of an R package like spatstat is possible from Rcpp. If yes, Could anyone help me on debugging the code? Best Regards, Mohammad Ghorbani I was wondering is it possible to call
_______________________________________________ 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