[R-sig-Geo] identical(coordinates)
Pinaud David
pinaud at cebc.cnrs.fr
Fri Feb 10 10:51:08 CET 2012
Dear all,
I need to convert several times sp objects from data.frame and use
zerodist2() to match locations.
As zerodist2() seems to use identical(), something seems strange to me:
library(sp)
xy <- data.frame(x=rnorm(4), y=rnorm(4))
dfxy <- xy
coordinates(xy) <- ~ x + y
dfxy[1,1]
coordinates(xy)[1,1]
identical(dfxy[1,1], coordinates(xy)[1,1])
> FALSE # I should expect TRUE!?
coordinates(dfxy) <- ~ x + y
identical(coordinates(dfxy)[1,1], coordinates(xy)[1,1])
> TRUE
Why identical(dfxy[1,1], coordinates(xy)[1,1]) gives FALSE?
Thanks,
David
sessionInfo()
R version 2.14.1 (2011-12-22)
Platform: i386-pc-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252
LC_MONETARY=French_France.1252 LC_NUMERIC=C
[5] LC_TIME=French_France.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rgdal_0.7-5 trip_1.1-10 maptools_0.8-12 lattice_0.20-0
foreign_0.8-48 rgeos_0.1-17 stringr_0.6
[8] sp_0.9-93 spatstat_1.25-1 deldir_0.0-16 mgcv_1.7-12
loaded via a namespace (and not attached):
[1] grid_2.14.1 Matrix_1.0-2 nlme_3.1-102 plyr_1.7.1 tools_2.14.1
--
***************************************************
Dr. David PINAUD
Ingénieur de Recherche "Analyses spatiales"
Centre d'Etudes Biologiques de Chizé - CNRS UPR1934
79360 Villiers-en-Bois, France
poste 485
Tel: +33 (0)5.49.09.35.58
Fax: +33 (0)5.49.09.65.26
http://www.cebc.cnrs.fr/
***************************************************
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pinaud.vcf
Type: text/x-vcard
Size: 324 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20120210/366833d1/attachment.vcf>
More information about the R-sig-Geo
mailing list