[R-sig-Geo] Coercing character to image

Roger Bivand Roger.Bivand at nhh.no
Tue Jun 24 22:57:26 CEST 2008


On Tue, 24 Jun 2008, Honey Giroday wrote:

>
> Thank you for your response and assisting me with clarifying my question.  Here is a portion of the code I am using:
>
> xxx04 <- ppp(x=mpb04$Easting, y=mpb04$Northing, window=tpi1.win)
> dens2004<-density(xxx04)
> save(dens2004, file="dens2003.Rdata"
> dens2004.load<-load("dens2004.Rdata")

This is the problem - dens2004.load contains the *name* of the loaded 
object(s). Try:

save(dens2004, file="dens2004.Rdata")
ls()
rm(dens2004)
print(load("dens2004.Rdata"))
ls()

See ?load.

Roger


> dens2004.im<-as.im(dens2004.load, W=tpi1.win)
>
> fm <- ppm(xxx04, ~x + y + density, Poisson(), covariates=list(dens2004.load) #"Error in model.frame.default(formula=fmla, data=glmdata, subset=(.mpl.SUBSET == : invalid type(closure) for variable 'density')
>
> I hope this elucidates the problem further.  Any help you can provide would be wonderful.  Thank you.
>
> Sincerely,
>
>
>
>
>
> Honey-Marie de la Giroday
>
>> Date: Tue, 24 Jun 2008 11:40:42 +0200
>> From: Roger.Bivand at nhh.no
>> To: girodayh at unbc.ca
>> CC: r-sig-geo at stat.math.ethz.ch
>> Subject: Re: [R-sig-Geo] Coercing character to image
>>
>> On Tue, 24 Jun 2008, Honey Giroday wrote:
>>
>>>
>>>
>>> Hi,
>>>
>>> I'm currently trying to use save() on a density plot (i.e. an image)
>>> that takes a long time to generate (using density(x)).  I want to be
>>> able to use the saved dataset as a covariate in ppm.  However, once my
>>> image is saved and loaded back in it is a character object instead of an
>>> image.  I tried using as.im to coerce the object to an image; however, I
>>> get an error message.
>>>
>>> Does anyone have a method for converting a character object to an image
>>> object?
>>
>> No, because you have not provided a code example to show what you did
>> (wrong). Please create an example using a data set included in spatstat,
>> reproducing your problem. We cannot see over your shoulder. My guess is
>> that your question is not the right question, because the problem arose
>> earlier in the workflow.
>>
>> Roger
>>
>>>
>>> Sincerely,
>>>
>>>
>>>
>>>
>>>
>>>
>>> Honey-Marie de la Giroday
>>>
>>> _________________________________________________________________
>>>
>>>
>>> 	[[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
>>>
>>
>> --
>> Roger Bivand
>> Economic Geography Section, Department of Economics, Norwegian School of
>> Economics and Business Administration, Helleveien 30, N-5045 Bergen,
>> Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
>> e-mail: Roger.Bivand at nhh.no
>>
>
> _________________________________________________________________
>
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list