[R-sig-Geo] Inf allowed in sp SpatialPoints

Michael Sumner mdsumner at utas.edu.au
Thu Apr 20 00:01:22 CEST 2006


Hello, thanks for all the help, BTW.

It seems that bbox coordinates in sp are tested for is.na, but not 
is.finite.  (The only finiteness test I see
in sp is in spDistsN1.)

Is there a good reason for this?  I can see that Inf/-Inf has meaning 
under some scenarios, but perhaps they
should not be allowed by default?

Cheers, Mike.
>
> library(sp)
>
>
> pts <- cbind(c(147, 148, 149), c(-42, -42, -44))
>
> pts.na <- pts
> pts.na[2,1] <- NA  # or NaN
>
> pts.inf <- pts
> pts.inf[2,] <- Inf
>
> SpatialPoints(pts, CRS("+proj=longlat"))
> SpatialPoints(pts.na)  #doesn't work,
> SpatialPoints(pts.inf) # does work is.na(Inf) is FALSE, but plot 
> doesn't like it
> sessionInfo()
R version 2.2.1, 2005-12-20, i386-pc-mingw32

attached base packages:
[1] "methods"   "stats"     "graphics"  "grDevices" "utils"     "datasets"
[7] "base"    

other attached packages:
      sp
"0.8-14"




More information about the R-sig-Geo mailing list