List Info

Thread: spatstat: trend to spatialgriddataframe - help needed




spatstat: trend to spatialgriddataframe - help needed
country flaguser name
Poland
2007-05-10 12:52:01
Hi

It seems very simple but I cannot pass throuh one step:

I computed trend (ppm) in spatstat package:

    ppm_2=ppm(unmark(pp), ~polynom(x,y,2))

next I found, that I can convert that  object to 
"something almost 
like  <<im>> object" :

    k=plot(ppm_2, ngrid=c(gmeta6()$cols, gmeta6()$rows), 
superimpose=FALSE, how="image", pause=FALSE,
plot.it=FALSE)

but: it is not im object. It is object which only contains
im inside. 
Here is its structure:

str(k)
List of 1
 $ trend:List of 1
  ..$ :List of 11     ##here is something like "unnamed
atribute" I 
cannot pass this
  .. ..$ v     : num [1:986, 1:1051] 1.06e-09 1.07e-09
1.08e-09 1.10e-09 
1.11e-09 ...
  .. ..$ dim   : int [1:2] 986 1051
  .. ..$ xrange: num [1:2] 3684409 3713995
  .. ..$ yrange: num [1:2] 5649780 5681325
  .. ..$ xstep : num 28.2
  .. ..$ ystep : num 32
  .. ..$ xcol  : num [1:1051] 3684423 3684451 3684479
3684507 3684535 ...
  .. ..$ yrow  : num [1:986] 5649796 5649828 5649860 5649892
5649924 ...
  .. ..$ lev   : NULL
  .. ..$ type  : chr "real"
  .. ..$ units :List of 3
  .. .. ..$ singular  : chr "unit"
  .. .. ..$ plural    : chr "units"
  .. .. ..$ multiplier: num 1
  .. .. ..- attr(*, "class")= chr
"units"
  .. ..- attr(*, "class")= chr "im"
 - attr(*, "class")= chr "plotppm"
 - attr(*, "mrkvals")= num 1


I simply don't know how extract that part which is im object
(to convert 
it next to spatialgriddataframe) or even only v (v I can
insert to any 
im object and next to convert it)

I hope that problem is trivial to more advanced R users

Jarek




_______________________________________________
statsgrass mailing list
statsgrassgrass.itc.it
http:
//grass.itc.it/mailman/listinfo/statsgrass

Re: spatstat: trend to spatialgriddataframe - help needed
country flaguser name
Norway
2007-05-10 14:00:18
On Thu, 10 May 2007, Jarekj Jasiewicz wrote:

> Hi
> 
> It seems very simple but I cannot pass throuh one
step:
> 
> I computed trend (ppm) in spatstat package:
> 
>     ppm_2=ppm(unmark(pp), ~polynom(x,y,2))
> 
> next I found, that I can convert that  object to 
"something almost 
> like  <<im>> object" :
> 
>     k=plot(ppm_2, ngrid=c(gmeta6()$cols,
gmeta6()$rows), 
> superimpose=FALSE, how="image", pause=FALSE,
plot.it=FALSE)
> 
> but: it is not im object. It is object which only
contains im inside. 
> Here is its structure:
> 
> str(k)
> List of 1
>  $ trend:List of 1
>   ..$ :List of 11     ##here is something like
"unnamed atribute" I 
> cannot pass this

Try str(k$trend[[1]]$v) - if this accesses the matrix with
the [[ operator
(first unnamed component of trend), then the other bits
ought to follow.
Please note that polynom() does not protect the powered
coordinates from
numerical overflow, so I'd be cautious unless you know that
x and y are
only small numbers.

Roger

>   .. ..$ v     : num [1:986, 1:1051] 1.06e-09 1.07e-09
1.08e-09 1.10e-09 
> 1.11e-09 ...
>   .. ..$ dim   : int [1:2] 986 1051
>   .. ..$ xrange: num [1:2] 3684409 3713995
>   .. ..$ yrange: num [1:2] 5649780 5681325
>   .. ..$ xstep : num 28.2
>   .. ..$ ystep : num 32
>   .. ..$ xcol  : num [1:1051] 3684423 3684451 3684479
3684507 3684535 ...
>   .. ..$ yrow  : num [1:986] 5649796 5649828 5649860
5649892 5649924 ...
>   .. ..$ lev   : NULL
>   .. ..$ type  : chr "real"
>   .. ..$ units :List of 3
>   .. .. ..$ singular  : chr "unit"
>   .. .. ..$ plural    : chr "units"
>   .. .. ..$ multiplier: num 1
>   .. .. ..- attr(*, "class")= chr
"units"
>   .. ..- attr(*, "class")= chr
"im"
>  - attr(*, "class")= chr "plotppm"
>  - attr(*, "mrkvals")= num 1
> 
> 
> I simply don't know how extract that part which is im
object (to convert 
> it next to spatialgriddataframe) or even only v (v I
can insert to any 
> im object and next to convert it)
> 
> I hope that problem is trivial to more advanced R
users
> 
> Jarek
> 
> 
> 
> 
> _______________________________________________
> statsgrass mailing list
> statsgrassgrass.itc.it
> http:
//grass.itc.it/mailman/listinfo/statsgrass
> 

-- 
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.Bivandnhh.no

_______________________________________________
statsgrass mailing list
statsgrassgrass.itc.it
http:
//grass.itc.it/mailman/listinfo/statsgrass

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )