[Rcpp-devel] Using spatstat in Rcpp
mohammad ghorbani
ghorbani_ms at yahoo.com
Wed Jun 11 19:01:14 CEST 2014
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20140611/f17f6e4d/attachment.html>
More information about the Rcpp-devel
mailing list