Mehdi Khan
2009-Aug-25 05:56 UTC
[R] Fwd: Overlay on raster loses points when merging with data frame
Does anyone have an idea about this, it's driving me insane! Hello everyone. I have overlayed 1611 points on top of a tif file. tifclassoverlay<-overlay(CRS11, classifiedmodrobin) overlaydf<-as.data.frame(tifclassoverlay) tifol<-remove.na.rows(overlaydf) tifol is 854 rows long. tifol has predicted data, while the classifiedmodrobin matrix has observed data. When I try to merge the two, I get a length of 827: ngafulldf<-as.data.frame(classifiedmodrobin) NGAfiledata<-merge(tifol, ngafulldf,all=FALSE, by=c("LON", "LAT")) NGAfiledata<-unique(NGAfiledata) NGAfiledata<-remove.na.rows(NGAfiledata) The length should obviously still be 854. What happened to the missing rows? How can I get them back? Thank you very much!! Here is a sample of what the data looks like: LON LAT Net STA ELEVATION vs30 tif.cat 1 -3086165 3718184 CI NEE2 271 363 8 2 -3143337 3500449 CI EMS 11 336 14 3 -3155773 3704130 CI DAN 428 304 4 4 -3173788 3722206 CI GRP 978 509 4 5 -3188256 3548775 EN SIM -64 264 NA 6 -3193879 3549663 EN RED -64 322 NA 7 -3195312 3547901 CI RXH -59 331 NA 8 -3214063 3540800 CI ERR -56 233 8 9 -3219756 3587780 CI NSS2 17 246 4 10 -3226717 3558278 CI SAL 14 473 8 11 -3229979 3516218 CI CRR 66 315 4 12 -3238308 3596300 CI THX -31 244 12 13 -3247148 3667171 CI GTM 836 306 7 14 -3254339 3615978 CI MGE 68 330 4 15 -3257283 3597678 CI PMD 296 257 3 I am assuming there is no precision error since there are no decimals.. Thanks! Mehdi Khan [[alternative HTML version deleted]]