[R-sig-Geo] raster::extract NAs introduced?

Agustin Lobo alobolistas at gmail.com
Fri Mar 25 14:58:07 CET 2011


Hi

I've found that extract() introduces NAs:
SGRGBF40 = brick("/media/Iomega_HDD/UAVetal/CALIBRACIONRADIOM/TESTCASA/CALSEL/SGRGB/SGRGBWBPS125F40.tif")
calibf2 = readOGR(dsn="/media/Iomega_HDD/UAVetal/CALIBRACIONRADIOM/TESTCASA/CALSEL",layer="calibf2",stringsAsFactors=F)
projection(SGRGBF40) = projection(calibf2)
plot(subset(SGRGBF40,1))
plot(calibf2,add=T)
(overlay is ok now)

> summary(SGRGBF40)
Cells:  4646400
NAs  :  0 0 0

            1     2     3
Min.     2629     3     3
1st Qu. 34100 22200 18290
Median  42470 27480 24680
Mean    40900 28510 25360
3rd Qu. 48360 33100 29010
Max.    65510 65510 64300
summary based on a sample of 5000 cells, which is 0.107610192837466 %
of all cells
To make sure (NAs could outside the sample):
> any(is.na(SGRGBF40))
class       : RasterLayer
dimensions  : 1760, 2640, 1  (nrow, ncol, nlayers)
resolution  : 1, 1  (x, y)
extent      : 0, 2640, -1759, 1  (xmin, xmax, ymin, ymax)
projection  : +proj=utm +zone=31 +ellps=intl +units=m +no_defs
values      : in memory
min value   : 0
max value   : 1
So no NAs
But:
> summary(v)
 SGRGBWBPS125F40_1 SGRGBWBPS125F40_2 SGRGBWBPS125F40_3
 Min.   :18444     Min.   :  119.4   Min.   :    3
 1st Qu.:33227     1st Qu.:25516.4   1st Qu.:15633
 Median :37752     Median :36264.1   Median :22374
 Mean   :40208     Mean   :36275.1   Mean   :29737
 3rd Qu.:46899     3rd Qu.:48052.5   3rd Qu.:48116
 Max.   :64992     Max.   :63667.1   Max.   :63826
 NA's   :    5     NA's   :    1.0


Any explanation to this? Not a big problem (can use na.rm) but I'm
concerned on this problem implying
the means not being correct.

Agus



More information about the R-sig-Geo mailing list