If 'X' is a data frame containing columns 'x', 'y' and 'value, try

        m <- with(X, tapply(value, list(y,x), all))
        z <- im(m, xcol=sort(unique(X$x)), yrow=sort(unique(X$y)))
        w <- as.owin(z)

This will only work if the x, y values form a rectangular grid in some order.

Adrian Baddeley

=============================================
Javier PB wrote:

Dear users,

I am trying to export polygons from Arcmap into Spatstat to run some
simulations using functions available in Spatstat package.

One particular area to be exported is formed by a number of polygons
defining the external boundaries of the area (as a groups of islands) and a
number of polygons inside the previous ones,  as “holes” not to be
considered as part of the area.

I have managed to export one of these areas using owin(poly=list()),
including in the list the number of external boundaries and holes, but the number of polygons that constitute each area is large and I was wondering if this could be easily done using owin(mask=my_area), using only one single
matrix file "my_area" with TRUE, FALSE values defining the whole area.

Here is where I got stuck. The file I have created in ArcMap contains three columns: x and y coordinates, and the values at points x[i], y[j] (1 if the
area is TRUE and 0 is the area is FALSE).

How can I covert this xy file into a mask type "my_area" that I can read
using owin(mask=my_area)?

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to