Thanks Sarah and Mauricio,

here's the example

> library(gstat)
> setwd("/home/acmonmany/matricesDN")
> tuc11.2.frm = read.table("plot11_2.txt", header=T)
> coordinates(tuc11.2.frm) <- c("X", "Y")
> proj4string(tuc11.2.frm) <-CRS("+proj=utm +zone=20 +south +ellps=intl
+towgs84=-355,21,72,0,0,0,0 +units=m +no_defs")
> variog11.2 <- variogram(reflectance~1, data=tuc11.2.frm)
> save(variog11.2, file="tuc11.2.200.var.Rdata")

NOW when I try to load the saved file (I do not change directory and I can
see the files there, in the directory stated above):


> load("tuc11.2.200.var.Rdata")
> class("tuc11.2.200.var.Rdata")
[1] "character"
> summary(tuc11.2.200.var)
Error in summary(tuc11.2.200.var) :
  error in evaluating the argument 'object' in selecting a method for
function 'summary': Error: object 'tuc11.2.200.var' not found


So do you think that before saving I sould change directory to my home?



2012/11/5 Mauricio Zambrano-Bigiarini <mauricio.zambrano@jrc.ec.europa.eu>

> 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/<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@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@r-project.org
>>>> https://stat.ethz.ch/mailman/**listinfo/r-sig-geo<https://stat.ethz.ch/mailman/listinfo/r-sig-geo>
>>>>
>>>>
>>>
>>> --
>>> Sarah Goslee
>>> http://www.stringpage.com
>>> http://www.sarahgoslee.com
>>> http://www.**functionaldiversity.org<http://www.functionaldiversity.org>
>>>
>>>
>>
>>
>>
>


-- 
---------------------------
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]]

