[R-sig-Geo] missing values in gstat for R

Friederike.Gerschlauer at agrar.uni-giessen.de Friederike.Gerschlauer at agrar.uni-giessen.de
Tue Dec 1 10:22:49 CET 2009


Dear list,

I am having problems with dealing with missing values in gstat  
computing a semivariogram.

I am using R 2.9.1, gstat 0.9-64 on Windows Vista.

I get the following error message:

g <- gstat(id = "sm", formula = smoist.20.06.2005 ~ 1, data = soildmD79.sp)
g <- gstat(g, id = "bd", formula = BD ~ 1, data =  
soildmD79.sp[!is.na(soildmD79.sp$BD),])
g <- gstat(g, id = "S", formula = S ~ 1, data =  
soildmD79.sp[!is.na(soildmD79.sp$S),])
g <- gstat(g, id = "U", formula = U ~ 1, data =  
soildmD79.sp[!is.na(soildmD79.sp$U),])
g <- gstat(g, id = "T", formula = T ~ 1, data =  
soildmD79.sp[!is.na(soildmD79.sp$T),])
g <- gstat(g, id = "GMD", formula = GMD ~ 1, data =  
soildmD79.sp[!is.na(soildmD79.sp$GMD),])
g <- gstat(g, id = "vcover", formula = vcover ~ 1, data =  
soildmD79.sp[!is.na(soildmD79.sp$vcover),])
g <- gstat(g, id = "mean_C", formula = mean_C~ 1, data =  
soildmD79.sp[!is.na(soildmD79.sp$mean_C),])
g <- gstat(g, id = "biomass", formula = biomass  ~ 1, data =  
soildmD79.sp[!is.na(soildmD79.sp$biomass),])
png(file = "sm_soilparamter_cross_20-06-2005.png", width = 1400,  
height = 1000, bg = "white", res = 100)
plot(variogram(g), main = "Cross variograms Soil moisture and stable  
soil parameters", sub="20/06/2005")

Error: dimensions do not match: locations 200 and data 96

This message occurs due to 100 x,y coordinate pairs and 96 values for  
the variable soil moisture.
Even though the function contains already "data =  
soildmD79.sp[!is.na(soildmD79.sp$BD),]" the missing values still cause  
an error.

Thanks for any suggestions or comments,
Friederike



More information about the R-sig-Geo mailing list