[R-sig-Geo] Error in fit.variogram in gstatVariogram recalled from file
Paul Hiemstra
p.hiemstra at geo.uu.nl
Fri Oct 31 10:00:43 CET 2008
Hi Cora,
A mucht better way of storing R-objects in files is through the use of
the save() command. The load() command is the equivalent to reload the
file. Example in code:
vmodel = vgm(10, "Exp", 300, 4.5)
save(vmodel, file = "vmodel.rda")
# reloading the file
load("vmodel.rda")
see ?save and ?load for more details.
cheers,
Paul
Cora Shea wrote:
> Dear List,
>
> In the hopes that someone may know why, I will describe an error I get from
> fit.variogram when reading a variogram from a file.
>
> When I create a gstatVariogram object in a given R session, I can use
> fit.variogram upon it just fine via:
>
>> temp.vgm <- variogram(z~x.coord+y.coord, temp.frame, cressie=T)
>> temp.fit <- fit.variogram(temp.vgm,v.model,fit.method=1)
>>
>>
>
> Then, I store that same gstatVariogram object in a file via write.table:
>
>> write.table(temp.vgm,file=file.name)
>>
>
> And then, when I later recall it using read.table:
>
>> temp.vgm <- read.table(file.name)
>> class(temp.vgm) <- "gstatVariogram"
>>
>>
>
> But....then I can no longer perform the fit.variogram upon it using the
> exact same v.model. I receive the error:
>
>> temp.fit <- fit.variogram(temp.vgm,v.model,fit.method=1)
>>
> Error in fit.variogram(temp.vgm, v.model, fit.method = 1) :
> REAL() can only be applied to a 'numeric', not a 'integer'
>
> I would very much like to have these variograms in files and then use them
> later and on different computers, and I can unfortunately find no
> information on this error.
>
> Thank you for any help you can provide, and thank you for your time.
>
> Cora
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: +31302535773
Fax: +31302531145
http://intamap.geo.uu.nl/~paul
More information about the R-sig-Geo
mailing list