<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
<br>
Okay --- I think I've tracked it down. The problem is (I believe)
with the value<br>
of "huge" in the nncross() function --- which just isn't huge
enough. It was taken<br>
to be the diameter of X$window, which could in fact be quite small
relative to<br>
the distances between the points of X and the points of Y (and will
in fact be<br>
*zero* when applying the function returned by distfun() if the
argument to<br>
distfun() has only one point).<br>
<br>
I've amended nncross() to take "huge" to be the diameter of<br>
<br>
union.owin(X$window,Y$window)<br>
<br>
This seems to work ... although there may be a better strategy.
(Over to you,<br>
Adrian).<br>
<br>
I have attached my amended version of nncross, which you can source
into<br>
you can use until a release of "spatstat" containing this, or a more
appropriate fix<br>
comes out.<br>
<br>
Note that you need to do<br>
<br>
assignInNamespace("nncross",nncross,"spatstat")<br>
<br>
after sourcing in nncross.R, otherwise distfun() will use the "old"
version of nncross<br>
rather than the amended one. And you have to (psigh!) do the
assignInNamespace()<br>
thing each time you start a new R session, in order to get the right
nncross() function<br>
being called.<br>
<br>
cheers,<br>
<br>
Rolf Turner<br>
<br>
On 15/01/12 11:55, ONKELINX, Thierry wrote:
<blockquote
cite="mid:AA818EAD2576BC488B4F623941DA74275732B213@inbomail.inbo.be"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
<div style="direction: ltr; font-family: Tahoma; color: rgb(0, 0,
0); font-size: 10pt;">Dear all,<br>
<br>
I'm not getting the output I'm expecting when using distfun()
from the spatstat package. Any idea what is going wrong?<br>
<br>
Best regards,<br>
<br>
Thierry<br>
<br>
library(spatstat)<br>
w <- owin(xrange = c(-10, 10), yrange = c(-10, 10))<br>
P <- ppp(x = 0, y = 0, window = w)<br>
P1 <- ppp(x = 1, y = 0, window = w)<br>
P2 <- ppp(x = 1:2, y = c(1, 1), window = w)<br>
P3 <- ppp(x = 2:1, y = c(2, 2), window = w)<br>
f <- distfun(P)<br>
f2 <- distfun(P2)<br>
fo <- list(f(P1), f(P2), f(P3))<br>
fo2 <- list(f2(P), f2(P1), f2(P3))<br>
<br>
> fo<br>
[[1]]<br>
[1] 0<br>
<br>
[[2]]<br>
[1] 1 1<br>
<br>
[[3]]<br>
[1] 1 1<br>
<br>
> fo2<br>
[[1]]<br>
[1] 0<br>
<br>
[[2]]<br>
[1] 0<br>
<br>
[[3]]<br>
[1] 1 1<br>
<br>
> sessionInfo()<br>
R version 2.14.1 (2011-12-22)<br>
Platform: x86_64-pc-linux-gnu (64-bit)<br>
<br>
locale:<br>
[1] LC_CTYPE=nl_BE.UTF-8 LC_NUMERIC=C <br>
[3] LC_TIME=nl_BE.UTF-8 LC_COLLATE=nl_BE.UTF-8 <br>
[5] LC_MONETARY=nl_BE.UTF-8 LC_MESSAGES=nl_NL.UTF-8 <br>
[7] LC_PAPER=C LC_NAME=C <br>
[9] LC_ADDRESS=C LC_TELEPHONE=C <br>
[11] LC_MEASUREMENT=nl_BE.UTF-8 LC_IDENTIFICATION=C <br>
<br>
attached base packages:<br>
[1] stats graphics grDevices utils datasets methods
base <br>
<br>
other attached packages:<br>
[1] spatstat_1.25-1 deldir_0.0-16 mgcv_1.7-12 <br>
<br>
loaded via a namespace (and not attached):<br>
[1] grid_2.14.1 lattice_0.20-3 Matrix_1.0-3 nlme_3.1-102 <br>
<br>
</div>
</blockquote>
<br>
</body>
</html>