[R-sig-Geo] Raster package: colFromX behaviour
    Jonathan 
    j2kennel at gmail.com
       
    Sun Apr 14 02:11:03 CEST 2013
    
    
  
Hello group,
I am trying to get the column from point that exists the interfaces of two
cells and find that the results I'm getting are not consistent.  In the
below example I am getting the higher boundary for the cell for 0.1, 0.2,
and 0.4.  However, I get the lower boundary for 0.3.  
My current solution is to add a very small number to the coordinate if the
value falls on the interface but does anyone know a better workaround?
library(raster)
H <- raster(matrix(sample.int(100), ncol=10))
colFromX(H, 0.1)  # 2
colFromX(H, 0.2)  # 3
colFromX(H, 0.3)  # 3
colFromX(H, 0.4)  # 5
colFromX(H, 0.30000000000000001)  #3
colFromX(H, 0.3000000000000001)   #4
Cheers,
-Jonathan
Session Info 
R version 3.0.0 (2013-04-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    
attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
other attached packages:
[1] raster_2.1-16 sp_1.0-8     
loaded via a namespace (and not attached):
[1] grid_3.0.0      lattice_0.20-15 tools_3.0.0   
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Raster-package-colFromX-behaviour-tp7583304.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
    
    
More information about the R-sig-Geo
mailing list