[R-sig-Geo] krige() option na.action

Edzer Pebesma edzer.pebesma at uni-muenster.de
Sun Apr 19 16:06:41 CEST 2009


Jeroen Druyts wrote:
> Hello,
>
> the output of krige() returns some NA values. I'd like to draw a semivariogram of this output, but then I get the warning
> "Error: dimensions do not match: locations 109078 and data 54536" This is because of the three NA-values in the predictions of krige (109078/2=54539). 
>   
Is it unreasonable that these NA values are returned? What causes them?
> I tried allready with the command na.action = na.omit in the krige command, but the NA's keep appearing.
> How do I prevent that there are NA values in the krige() output?
>   
As an alternative, you could try to remove them when passing data to
variogram():

library(gstat)
data(meuse)
coordinates(meuse) = ~x+y
meuse$z = meuse$zinc
meuse$z[1]=NA
variogram(z~1,meuse) # fails
variogram(z~1,meuse[!is.na(meuse$z),]) #passes

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de/
http://www.springer.com/978-0-387-78170-9 e.pebesma at wwu.de



More information about the R-sig-Geo mailing list