[R-sig-Geo] Saving a variogram in gstat

Mauricio Zambrano-Bigiarini mauricio.zambrano at jrc.ec.europa.eu
Mon Nov 5 15:28:56 CET 2012


The following reproducible example works for me
(please run it in a new session):

  -------- START ----------
  library(gstat)
  data(meuse)

  # no trend:
  coordinates(meuse) = ~x+y
  myvgm <- variogram(log(zinc)~1, meuse)

  # saving the variogram to your home directory
  setwd("~")
  save(myvgm, file="Myvgm.RData")

  ## remove (almost) everything in the working environment.
  ## IMPORTANT:: You will get no warning, so
  ## don't do this unless you are really sure.
  rm(list = ls())

  ## Loading the variogram
  load("Myvgm.RData")
  summary(myvgm)
-------- END ----------


IHTH,

Mauricio

-- 
=================================================
Water Resources Unit
Institute for Environment and Sustainability (IES)
Joint Research Centre (JRC), European Commission
TP 261, Via Enrico Fermi 2749, 21027 Ispra (VA), IT
webinfo    : http://floods.jrc.ec.europa.eu/
=================================================
DISCLAIMER:
"The views expressed are purely those of the writer
and may not in any circumstances be regarded as sta-
ting an official position of the European Commission"
=================================================
Linux user #454569 -- Ubuntu user #17469
=================================================
"It is a mistake to look too far ahead. Only one
link in the chain of destiny can be handled at a time"
(Sir Winston Churchill)



On 05/11/12 15:04, carolina monmany wrote:
> Thanks, Sarah. I've tried that and it looks like it is loaded but when I
> try to do anything such as plot(variog1) or fit it it does not work. When I
> ask
>
> class(variog1)
>
> it says
>
> character
>
>
> 2012/11/5 Sarah Goslee<sarah.goslee at gmail.com>
>
>> If you use save() to save your variograms, you need to use load() to load
>> them.
>>
>> load("variog1.Rdata")
>>
>> Sarah
>>
>>
>> On Monday, November 5, 2012, carolina monmany wrote:
>>
>>> Dear all,
>>>
>>> I am using R 2.15.1 and the package gstat in Linux to calculate variograms
>>> from large datasets (200x200m high resolution satellite images).
>>>
>>> I need to save all the variograms for later modelling and others and I
>>> realized late that I was using the wrong command:
>>>
>>> save(variog1, file="variog1.Rdata")
>>>
>>> the variograms were being indeed saved but I cannot open them again
>>>   because they not being saved as variograms but as characters.
>>>
>>> I tried to save them using the suggested command:
>>>
>>> data(variog1): 'variog1';
>>>
>>> with no success. My main question is: is there a way I can recover the
>>> already saved variograms?
>>> And the other question : what is the correct syntaxis for saving
>>> variograms
>>> in gstat?
>>>
>>> Thanks  a lot.
>>> --
>>> ---------------------------
>>> A. CAROLINA MONMANY
>>> Universidad de Puerto Rico
>>> Departamento de Biologia - CN 235
>>> POBOX 23360
>>> San Juan, Puerto Rico 00931-3360
>>> Tel: +1 787 764 0000 x2847
>>> Fax: +1 787 764 2610
>>>
>>>          [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>
>>
>> --
>> Sarah Goslee
>> http://www.stringpage.com
>> http://www.sarahgoslee.com
>> http://www.functionaldiversity.org
>>
>
>
>



More information about the R-sig-Geo mailing list