[R-sig-Geo] quadracount on multitype points

Guy Bayegnak Guy.Bayegnak at gov.ab.ca
Wed Sep 13 01:08:37 CEST 2017


Thanks a lot for your response and suggestion Rolf.  Yes, by "quadrant" I mean the little sub-windows.  My problem is the following:

We have collected thousands of groundwater samples across a vast area, and analysed them. Based on the analysis we are able to assign a "type" to each water sample.  When plotted, there seems to be a spatial trend in water type. But a given area may have more than one water type,  usually with a dominant type (most frequently occurring). What I am trying to do is identify the dominant type for each sub-region /sub-windows but show the count side by side, for example:

          x
 y         [0,0.801)            [0.801,1.6]
  [0.5,1]   Off =     36                Off =  6
           On =   3     On = 39

   [0,0.5)   Off =  4              Off = 36
            On = 42        On = 6

I think I can achieve what I am looking for with your suggestion. Once I get the table list, I will copy the numbers side by side manually.

Sincerely,

Guy

-----Original Message-----
From: Rolf Turner [mailto:r.turner at auckland.ac.nz]
Sent: September 12, 2017 3:45 PM
To: Guy Bayegnak <Guy.Bayegnak at gov.ab.ca>
Cc: r-sig-geo at r-project.org; Adrian.Baddeley at curtin.edu.au; Ege Rubak <rubak at math.aau.dk>
Subject: Re: [R-sig-Geo] quadracount on multitype points


On 13/09/17 02:11, Guy Bayegnak wrote:

> Dear all,
>
> I am working on a multitype point pattern, and I'd like to estimate
> how many of each type of point occurs into each quadrant. I know it is
> possible to use the quandracount on split marks as follows using
> spatstats: quadratcount(split(marks)). But the result produces as many
> windows as they are marks. I am wondering is there is a way to know
> many occurrence of each type there is per quadrant and to plot it in a
> single grid.
>
> Thanks.

You really should start by mentioning that you are dealing with the spatstat package.

It's not clear to me what you are after.  A minimal reproducible example would be helpful.  I presume that by "quadrant" you mean one of the four equal sub-windows formed by bisecting your (rectangular) window vertically and horizontally.

If my presumption is correct then perhaps

     lapply(split(X),quadratcount,nx=2)

(where "X" is your point pattern) does what you want.  E.g.:

> lapply(split(amacrine),quadratcount,nx=2)
> $off
>          x
> y         [0,0.801) [0.801,1.6]
>   [0.5,1]        36          36
>   [0,0.5)        34          36
>
> $on
>          x
> y         [0,0.801) [0.801,1.6]
>   [0.5,1]        35          39
>   [0,0.5)        42          36

Is this something like what you wish to achieve?

cheers,

Rolf Turner

--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.


More information about the R-sig-Geo mailing list