<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div style="" class="" id="yiv4776734297"><div style="" class=""><div class="" style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt;"><div style="" class="" id="yiv4776734297yui_3_16_0_1_1402502261301_11986">Hi there,</div><div style="" class="" id="yiv4776734297yui_3_16_0_8_1402502261301_8"><br style=""></div><div class="" style="color:rgb(0, 0, 0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;">I would like to call discpartarea() and as.owin() functions of spatstat from Rcpp. In a simple example <br style="" class="">consider the following C++ code in which I'm trying to access the above
functions:<br style="" class=""><br style="" class="">#include <Rcpp.h><br style="" class="">using namespace Rcpp;<br style="" class=""><br style="" class="">// [[Rcpp::export]]<br style="" class="">NumericVector IndepSelfCortCpp( NumericMatrix obsu) {<br style="" class=""> NumericMatrix obsxy = obsu( _ , Range(1,2) ) ;<br style="" class=""> NumericVector xyW= NumericVector::create(0,56,0,38);<br style="" class=""> double rslt = 0; <br style="" class=""> <br style="" class=""> rslt= spatstat::discpartarea(obsxy, 0.1, spatstat::as.owin(xyW));<br style="" class=""> <br style="" class="">return (rslt);<br style="" class="">}<br style="" class="">/* ** R<br style="" class="">obsu <- matrix(c(0.5, 1.5, 4, 12, 1,2,3,4,2,3,5,7), ncol=3)<br style="" class="">IndepSelfCortCpp(obsu)<br style="" class="">*/<br style="" class=""><br style="" class=""><div style="" class="">When I
source the file in Rstudio with sourceCpp(), I get the error:</div>" 'spatstat' has not been declard "<br style="" class=""><br style="" class="">I was wondering, a direct call a function of an R package like spatstat is possible from Rcpp.<br style="" class="">If yes, Could anyone help me on debugging the code? <br><br>Best Regards,<br>Mohammad Ghorbani<br style="" class=""><br style="" class=""><br style="" class=""></div><br style="" class=""><br style="" class=""><br style="" class=""></div><div class="" style="color:#000;background-color:#fff;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt;"><div style="" class="" id="yiv4776734297yui_3_16_0_1_1402502261301_11986"> </div><div style="" class="" id="yiv4776734297yui_3_16_0_8_1402502261301_8"><br style="" class="" id="yiv4776734297yui_3_16_0_8_1402502261301_13"></div><div class="" style="color:rgb(0, 0,
0);font-size:16px;font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;background-color:transparent;font-style:normal;" id="yiv4776734297yui_3_16_0_8_1402502261301_10">I was wondering is it possible to call </div></div></div></div></div></body></html>