Skip to content

gstat error

5 messages · gbrenes at ssc.wisc.edu, Peter Ehlers, David Winsemius +1 more

#
Hello.

I am running the examples provided in the gstat help menus.  When I try to
run the following in predict.gstat:

data(meuse)
coordinates(meuse)= ~x+y
v<-variogram(log(zinc)~1, meuse)

I get the following error message:

Error in vector("double", length) : invalid 'length' argument


What's the problem?


Gilbert
#
On 2011-08-03 09:40, gbrenes at ssc.wisc.edu wrote:
You should at the very least provide your sessionInfo().

Peter Ehlers
#
Here is my sessionInfo()
R version 2.12.2 (2011-02-25)
Platform: i386-pc-mingw32/i386 (32-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] splines   grid      stats     graphics  grDevices utils     datasets 
methods
[9] base

other attached packages:
 [1] spsurvey_2.1-2          lmtest_0.9-27           zoo_1.6-5
 [4] car_2.0-9               survival_2.36-5         nnet_7.3-1
 [7] spgwr_0.6-10            spatialCovariance_0.6-4 spatial_7.3-2
[10] spatgraphs_2.44         sgeostat_1.0-23         rworldmap_0.1211
[13] fields_6.3              spam_0.23-0             RPyGeo_0.9-2
[16] RSAGA_0.91-1            shapefiles_0.6          RgoogleMaps_1.1.9.7
[19] raster_1.8-22           RArcInfo_0.4-10         RColorBrewer_1.0-2
[22] PBSmodelling_2.61.210   PBSmapping_2.61.9       mapproj_1.1-8.3
[25] mapdata_2.1-4           intamap_1.3-8           evd_2.2-4
[28] mvtnorm_0.9-96          automap_1.0-9           rgdal_0.6-33
[31] gmaps_0.2               maps_2.1-6              glmmBUGS_1.9
[34] spdep_0.5-32            coda_0.14-2             deldir_0.0-13
[37] maptools_0.8-7          foreign_0.8-42          Matrix_0.999375-46
[40] lattice_0.19-17         boot_1.2-43             abind_1.3-0
[43] MASS_7.3-11             geosphere_1.2-19        geonames_0.8
[46] rjson_0.2.3             ctv_0.7-2               GEOmap_1.5-13
[49] akima_0.5-4             RPMG_2.0-5              splancs_2.01-27
[52] geomapdata_1.0-4        geoRglm_0.8-33          geoR_1.6-34
[55] gstat_0.9-81            sp_0.9-81               nlme_3.1-98

loaded via a namespace (and not attached):
[1] tcltk_2.12.2 tools_2.12.2
#
I see a 'variogram' function in both spatial and gstat when I use ?? 
variogram on my machine that probably does not have even all of those  
packages installed. Are you sure they are the same (I looked .... they  
are not)  or failing that that the one you expect is being chosen? And  
are you even sure that there is not a third or a fourth 'variogram' in  
one of those other packages?
#
To add to David's comments (nice catch, BTW), I found three
variogram() functions as a result of ??variogram. The one that gets
used is from the package that is highest in the search path (notice
that gstat is 55th (!!)) - that would be the one from the spatial
package. [The other is in the SpatialExtremes package, which is not
loaded, so the one in spatial is masking the one in gstat.]

To use the variogram() function in gstat, call gstat::variogram (...).

Dennis
On Wed, Aug 3, 2011 at 12:04 PM, David Winsemius <dwinsemius at comcast.net> wrote: