if (FALSE) { # requireNamespace("spatstat.geom")
## use example polygons from
example(plotpolyf, ask = FALSE)
letterR # a simple "xylist"
letterR.owin <- spatstat.geom::owin(poly = letterR)
letterR.gpc_from_owin <- owin2gpc(letterR.owin)
## warns if "gpclib" is unavailable
if (is(letterR.gpc_from_owin, "gpc.poly")) {
letterR.xylist_from_gpc <- xylist(letterR.gpc_from_owin)
stopifnot(all.equal(letterR, lapply(letterR.xylist_from_gpc, `[`, 1:2)))
letterR.owin_from_gpc <- gpc2owin(letterR.gpc_from_owin)
stopifnot(all.equal(letterR.owin, letterR.owin_from_gpc))
}
}
Run the code above in your browser using DataLab