Closed idblr closed 3 years ago
I think this is because sf
is not updated to the new structure yet. I have been holding this back until spatstat.linnet
was published on CRAN. That has happened today, so I will try to move forward soon. Are you using this for a package or "just" for a script for yourself?
Hi Ege, this is for a vignette in an upcoming CRAN package update. The vignette is compiled with 'R.rsp' so should be stable if dependencies are updated. I am happy use the 'spatstat' v1.64-1 for this vignette update and release another update once this issue is resolved.
OK. I don't know what to recommend here. It will of course take some time before a new version of sf
using spatstat.geom
is available on CRAN.
Now that I have you: Could you try to install sf
from my newly updated fork https://github.com/rubak/sf/, and test that it works as expected in your workflow? It is not completely done yet so e.g. st_sample
doesn't work with spatstat samplers yet, but owin
-conversions should work fine.
Hi Ege, I'll wait for the new new version of sf
and use spatstat
v1.64-1.
I installed your updated fork and it did not change my output using spatstat.geom
v1.65-5 but it did change the output for spatstat
v1.64-1 to create an owin
similar to the bbox. Now both are rectangles.
I recently migrated to 'spatstat.geom' v1.65-5 from 'spatstat' v1.64-1
Please don't do this yet. No-one should be using spatstat.geom
until the new structure is completely in place, including the new spatstat
. I sent around a detailed message about the transition process. We will give a signal when the new structure is installed (in about 2 weeks from now).
@baddstats Yes, of course, wrong verb, apologies. I received your emails in December and am preparing my updates. Will hold off and wait for your signal.
@idblr I'm concerned about the fact that my updated version of sf
should make the wrong conversion. Could you please send me a reproducible example where this happens? When I have spatstat.geom
installed alongside spatstat
v.1.64-1 the updated version of sf
gives me the correct shape for spatstat.geom::as.owin
and the bbox for spatstat::as.owin
. This is what we expect to roll out to all users of sf
, so I'm very keen to hear if there is still a problem for you. If it is still problematic it could also be helpful if you try the example I have here: https://github.com/r-spatial/sf/pull/1596#issuecomment-774343437
Hi @rubak, happy to help! Here is a reproducible example with my sessionInfo()
at the end. The example is similar to the one above. I will run your example next.
I start with removing any previously installed sf
, spatstat
, and spatstat.geom
# Remove packages
remove.packages("sf")
#> Removing package from '/Library/Frameworks/R.framework/Versions/4.0/Resources/library'
#> (as 'lib' is unspecified)
#> Error in find.package(pkgs, lib): there is no package called 'sf'
remove.packages("spatstat")
#> Removing package from '/Library/Frameworks/R.framework/Versions/4.0/Resources/library'
#> (as 'lib' is unspecified)
remove.packages("spatstat.geom")
#> Removing package from '/Library/Frameworks/R.framework/Versions/4.0/Resources/library'
#> (as 'lib' is unspecified)
Clean install of sf
, spatstat
, and spatstat.geom
from CRAN
# Install from CRAN
install.packages("sf")
#>
#> The downloaded binary packages are in
#> /var/folders/51/r35_6_fj7lbd_ctbns2x49ccm70cn8/T//RtmpxBH7EW/downloaded_packages
install.packages("spatstat")
#>
#> The downloaded binary packages are in
#> /var/folders/51/r35_6_fj7lbd_ctbns2x49ccm70cn8/T//RtmpxBH7EW/downloaded_packages
install.packages("spatstat.geom")
#>
#> The downloaded binary packages are in
#> /var/folders/51/r35_6_fj7lbd_ctbns2x49ccm70cn8/T//RtmpxBH7EW/downloaded_packages
Load the necessary pacakges for the example
# Load libraries
library(sf)
#> Linking to GEOS 3.8.1, GDAL 3.1.4, PROJ 6.3.1
library(spatstat)
#> Loading required package: spatstat.data
#> Loading required package: nlme
#> Loading required package: rpart
#>
#> spatstat 1.64-1 (nickname: 'Help you I can, yes!')
#> For an introduction to spatstat, type 'beginner'
#>
#> Note: spatstat version 1.64-1 is out of date by more than 9 months; we recommend upgrading to the latest version.
library(spatstat.geom)
#> Registered S3 methods overwritten by 'spatstat.sparse':
#> method from
#> Complex.sparse3Darray spatstat
#> Math.sparse3Darray spatstat
#> Ops.sparse3Darray spatstat
#> Summary.sparse3Darray spatstat
#> anyNA.sparse3Darray spatstat
#> aperm.sparse3Darray spatstat
#> as.array.sparse3Darray spatstat
#> dimnames.sparse3Darray spatstat
#> dim.sparse3Darray spatstat
#> print.sparse3Darray spatstat
#> [.sparse3Darray
#> dimnames<-.sparse3Darray spatstat
#> dim<-.sparse3Darray spatstat
#> [<-.sparse3Darray spatstat
#> Registered S3 methods overwritten by 'spatstat.geom':
#> method from
#> Complex.im spatstat
#> Complex.imlist spatstat
#> Math.im spatstat
#> Math.imlist spatstat
#> mean.im spatstat
#> median.im spatstat
#> Ops.im spatstat
#> Ops.imlist spatstat
#> Summary.im spatstat
#> Summary.imlist spatstat
#> $.hyperframe spatstat
#> anyDuplicated.ppp spatstat
#> anyDuplicated.ppx spatstat
#> [.anylist spatstat
#> anyNA.im spatstat
#> as.array.im spatstat
#> as.character.unitname spatstat
#> as.data.frame.hyperframe spatstat
#> as.data.frame.im spatstat
#> as.data.frame.owin spatstat
#> as.data.frame.ppp spatstat
#> as.data.frame.ppx spatstat
#> as.data.frame.psp spatstat
#> as.data.frame.tess spatstat
#> as.double.im spatstat
#> as.function.im spatstat
#> as.function.owin spatstat
#> as.function.tess spatstat
#> as.list.hyperframe spatstat
#> as.matrix.im spatstat
#> as.matrix.owin spatstat
#> as.matrix.ppx spatstat
#> by.im spatstat
#> by.ppp spatstat
#> cbind.hyperframe spatstat
#> contour.funxy spatstat
#> contour.im spatstat
#> contour.imlist spatstat
#> contour.listof spatstat
#> cut.im spatstat
#> cut.ppp spatstat
#> [.diagramobj spatstat
#> dim.hyperframe spatstat
#> dim.im spatstat
#> dimnames.hyperframe spatstat
#> dim.owin spatstat
#> duplicated.ppp spatstat
#> duplicated.ppx spatstat
#> edit.hyperframe spatstat
#> edit.im spatstat
#> edit.ppp
#> edit.psp spatstat
#> format.numberwithunit spatstat
#> head.hyperframe spatstat
#> head.ppp spatstat
#> head.ppx spatstat
#> head.psp spatstat
#> head.tess spatstat
#> hist.funxy spatstat
#> hist.im spatstat
#> [.hyperframe spatstat
#> identify.ppp spatstat
#> identify.psp spatstat
#> [.im
#> image.im
#> image.imlist spatstat
#> image.listof spatstat
#> [.layered spatstat
#> levels.im spatstat
#> names.hyperframe spatstat
#> [.owin spatstat
#> persp.funxy spatstat
#> persp.im
#> plot.anylist
#> plot.barplotdata spatstat
#> plot.colourmap
#> plot.funxy spatstat
#> plot.hyperframe spatstat
#> plot.im
#> plot.imlist
#> plot.indicfun spatstat
#> plot.infline spatstat
#> plot.layered spatstat
#> plot.listof
#> plot.onearrow spatstat
#> plot.owin spatstat
#> plot.pp3 spatstat
#> plot.ppp
#> plot.pppmatching spatstat
#> plot.ppx spatstat
#> plot.psp spatstat
#> plot.quad spatstat
#> plot.quadratcount spatstat
#> plot.solist
#> plot.splitppp spatstat
#> plot.symbolmap spatstat
#> plot.tess
#> plot.textstring spatstat
#> plot.texturemap
#> plot.yardstick
#> [.pp3 spatstat
#> [.ppp spatstat
#> [.ppx spatstat
#> print.anylist spatstat
#> print.box3 spatstat
#> print.boxx spatstat
#> print.colourmap spatstat
#> print.distfun spatstat
#> print.ewcdf spatstat
#> print.funxy spatstat
#> print.hyperframe spatstat
#> print.im spatstat
#> print.indicfun spatstat
#> print.infline spatstat
#> print.layered spatstat
#> print.lut spatstat
#> print.nnfun spatstat
#> print.numberwithunit spatstat
#> print.onearrow spatstat
#> print.owin spatstat
#> print.pp3 spatstat
#> print.ppp spatstat
#> print.pppmatching spatstat
#> print.ppx spatstat
#> print.psp spatstat
#> print.quad spatstat
#> print.simplepanel spatstat
#> print.solist spatstat
#> print.splitppp spatstat
#> print.splitppx spatstat
#> print.summary.distfun spatstat
#> print.summary.funxy spatstat
#> print.summary.hyperframe spatstat
#> print.summary.im spatstat
#> print.summary.listof spatstat
#> print.summary.logiquad spatstat
#> print.summary.lut spatstat
#> print.summary.owin spatstat
#> print.summary.pp3 spatstat
#> print.summary.ppp spatstat
#> print.summary.psp spatstat
#> print.summary.quad
#> print.summary.solist spatstat
#> print.summary.splitppp spatstat
#> print.summary.splitppx spatstat
#> print.summary.unitname spatstat
#> print.symbolmap spatstat
#> print.tess spatstat
#> print.textstring spatstat
#> print.texturemap spatstat
#> print.timed spatstat
#> print.unitname spatstat
#> print.yardstick spatstat
#> [.psp spatstat
#> [.quad spatstat
#> quantile.ewcdf spatstat
#> quantile.im spatstat
#> rbind.hyperframe spatstat
#> relevel.im spatstat
#> relevel.ppp spatstat
#> relevel.ppx spatstat
#> round.pp3 spatstat
#> round.ppp spatstat
#> round.ppx spatstat
#> row.names.hyperframe spatstat
#> [.solist spatstat
#> sort.im spatstat
#> split.hyperframe
#> split.im spatstat
#> [.splitppp spatstat
#> split.ppp spatstat
#> split.ppx spatstat
#> [.splitppx spatstat
#> str.hyperframe spatstat
#> subset.hyperframe spatstat
#> subset.pp3 spatstat
#> subset.ppp spatstat
#> subset.ppx spatstat
#> subset.psp spatstat
#> summary.anylist spatstat
#> summary.distfun spatstat
#> summary.funxy spatstat
#> summary.hyperframe spatstat
#> summary.im spatstat
#> summary.listof spatstat
#> summary.logiquad spatstat
#> summary.lut spatstat
#> summary.owin spatstat
#> summary.pp3 spatstat
#> summary.ppp spatstat
#> summary.pppmatching spatstat
#> summary.ppx spatstat
#> summary.psp spatstat
#> summary.quad
#> summary.solist spatstat
#> summary.splitppp spatstat
#> summary.splitppx spatstat
#> summary.unitname spatstat
#> tail.hyperframe spatstat
#> tail.ppp spatstat
#> tail.ppx spatstat
#> tail.psp spatstat
#> tail.tess spatstat
#> [.tess spatstat
#> text.ppp spatstat
#> text.psp spatstat
#> unique.ppp spatstat
#> unique.ppx spatstat
#> unstack.layered spatstat
#> unstack.ppp spatstat
#> unstack.psp spatstat
#> unstack.solist spatstat
#> unstack.tess spatstat
#> update.im spatstat
#> update.symbolmap spatstat
#> with.hyperframe spatstat
#> xtfrm.im spatstat
#> $<-.hyperframe spatstat
#> [<-.anylist spatstat
#> dimnames<-.hyperframe spatstat
#> [<-.hyperframe spatstat
#> [<-.im spatstat
#> [<-.layered spatstat
#> [[<-.layered spatstat
#> levels<-.im spatstat
#> [<-.listof spatstat
#> names<-.hyperframe spatstat
#> [<-.ppp spatstat
#> row.names<-.hyperframe spatstat
#> [<-.solist spatstat
#> split<-.hyperframe spatstat
#> [<-.splitppp spatstat
#> split<-.ppp spatstat
#> [<-.splitppx spatstat
#> [<-.tess spatstat
#> spatstat.geom 1.65-5
#>
#> Attaching package: 'spatstat.geom'
#> The following objects are masked from 'package:spatstat':
#>
#> [.anylist, [.diagramobj, [.hyperframe, [.im, [.layered, [.owin,
#> [.pp3, [.ppp, [.ppx, [.psp, [.quad, [.solist, [.splitppp,
#> [.splitppx, [.tess, [[<-.layered, [<-.anylist, [<-.hyperframe,
#> [<-.im, [<-.layered, [<-.listof, [<-.ppp, [<-.solist, [<-.splitppp,
#> [<-.splitppx, [<-.tess, %(-)%, %(+)%, %mapp%, %mark%, %mrep%,
#> %msub%, %unit%, $.hyperframe, $<-.hyperframe, acedist.noshow,
#> acedist.show, add.texture, affine, affine.distfun, affine.im,
#> affine.layered, affine.owin, affine.ppp, affine.psp, affine.tess,
#> affinexy, affinexypolygon, allElementsIdentical, angles.psp,
#> anycrossing.psp, anyDuplicated.ppp, anyDuplicated.ppx, anylapply,
#> anylist, anyNA.im, append.psp, applynbd, applyPolyclipArgs,
#> applytolayers, area, area.default, area.owin, areaGain,
#> areaGain.diri, areaGain.grid, areaLoss, areaLoss.diri,
#> areaLoss.grid, areaLoss.poly, as.anylist, as.array.im, as.box3,
#> as.boxx, as.breakpts, as.character.unitname,
#> as.data.frame.hyperframe, as.data.frame.im, as.data.frame.owin,
#> as.data.frame.ppp, as.data.frame.ppx, as.data.frame.psp,
#> as.data.frame.tess, as.double.im, as.function.im, as.function.owin,
#> as.function.tess, as.hyperframe, as.hyperframe.anylist,
#> as.hyperframe.data.frame, as.hyperframe.default,
#> as.hyperframe.hyperframe, as.hyperframe.listof, as.hyperframe.ppx,
#> as.im, as.im.data.frame, as.im.default, as.im.distfun,
#> as.im.expression, as.im.function, as.im.funxy, as.im.im,
#> as.im.matrix, as.im.nnfun, as.im.owin, as.im.ppp, as.im.tess,
#> as.imlist, as.layered, as.layered.default, as.layered.listof,
#> as.layered.ppp, as.layered.solist, as.layered.splitppp,
#> as.list.hyperframe, as.listof, as.mask, as.mask.psp, as.matrix.im,
#> as.matrix.owin, as.matrix.ppx, as.owin, as.owin.boxx,
#> as.owin.data.frame, as.owin.default, as.owin.distfun,
#> as.owin.funxy, as.owin.im, as.owin.layered, as.owin.nnfun,
#> as.owin.owin, as.owin.ppp, as.owin.psp, as.owin.quad,
#> as.owin.quadratcount, as.owin.tess, as.polygonal, as.ppp,
#> as.ppp.data.frame, as.ppp.default, as.ppp.matrix, as.ppp.ppp,
#> as.ppp.psp, as.ppp.quad, as.ppplist, as.psp, as.psp.data.frame,
#> as.psp.default, as.psp.matrix, as.psp.owin, as.psp.psp,
#> as.rectangle, as.solist, as.tess, as.tess.im, as.tess.list,
#> as.tess.owin, as.tess.quadratcount, as.tess.tess, as.unitname,
#> AsymmDistance.psp, avenndist, bbEngine, bdist.pixels, bdist.points,
#> bdist.tiles, bdry.mask, beachcolourmap, beachcolours, border,
#> bounding.box.xy, bounding.box3, boundingbox, boundingbox.default,
#> boundingbox.im, boundingbox.linnet, boundingbox.lpp,
#> boundingbox.owin, boundingbox.ppp, boundingbox.psp,
#> boundingbox.solist, boundingcentre, boundingcentre.owin,
#> boundingcentre.ppp, boundingcircle, boundingcircle.owin,
#> boundingcircle.ppp, boundingradius, boundingradius.owin,
#> boundingradius.ppp, box3, boxx, break.holes, breakpts,
#> breakpts.from.r, by.im, by.ppp, cartesian, cbind.hyperframe,
#> cellmiddles, centroid.owin, check.arc, check.finespacing,
#> check.hist.lengths, checkbigmatrix, checkfields, chop.tess,
#> circumradius, circumradius.owin, circumradius.ppp, circunion,
#> clear.simplepanel, clickbox, clickdist, clickpoly, clickppp,
#> clip.infline, clip.psp, clippoly.psp, cliprect.psp, closepairs,
#> closepairs.pp3, closepairs.ppp, closethresh, closetriples, closing,
#> closing.owin, closing.ppp, closing.psp, cobble.xy, codetime,
#> coerce.marks.numeric, col.args.to.grey, col2hex, colourmap,
#> colouroutputs, colouroutputs<-, commonGrid, commonPolyclipArgs,
#> compatible, compatible.im, compatible.unitname, complement.owin,
#> complementarycolour, Complex.im, Complex.imlist, concatxy,
#> conform.imagelist, connected, connected.im, connected.owin,
#> connected.pp3, connected.ppp, connected.tess, contour.funxy,
#> contour.im, contour.imlist, contour.listof, convexhull,
#> convexhull.xy, convexify, convolve.im, coords, coords.ppp,
#> coords.ppx, coords.quad, coords<-, coords<-.ppp, coords<-.ppx,
#> corners, countingweights, covering, crossdist, crossdist.default,
#> crossdist.pp3, crossdist.ppp, crossdist.ppx, crossdist.psp,
#> crossing.psp, crosspairquad, crosspairs, crosspairs.pp3,
#> crosspairs.ppp, cut.im, cut.ppp, default.dummy, default.n.tiling,
#> default.ntile, delaunay, delaunayDistance, deltametric,
#> dflt.redraw, diagramobj, diameter, diameter.box3, diameter.boxx,
#> diameter.owin, dilated.areas, dilation, dilation.owin,
#> dilation.ppp, dilation.psp, dilationAny, dim.hyperframe, dim.im,
#> dim.owin, dimnames.hyperframe, dimnames<-.hyperframe, dirichlet,
#> dirichletAreas, dirichletEdges, dirichletVertices,
#> dirichletWeights, disc, discpartarea, discretise, discs,
#> dist2dpath, distfun, distfun.owin, distfun.ppp, distfun.psp,
#> distmap, distmap.owin, distmap.ppp, distmap.psp, do.as.im,
#> do.call.plotfun, domain, domain.distfun, domain.funxy, domain.im,
#> domain.layered, domain.nnfun, domain.pp3, domain.ppp, domain.ppx,
#> domain.psp, domain.quad, domain.quadratcount, domain.tess,
#> drawSignedPoly, duplicated.ppp, duplicated.ppx, edges,
#> edges2triangles, edges2vees, edit.hyperframe, edit.im, edit.ppp,
#> edit.psp, ellipse, emptywindow, endpoints.psp, equalpairs.quad,
#> equals.quad, equalsfun.quad, eroded.areas, eroded.volumes,
#> eroded.volumes.box3, eroded.volumes.boxx, erodemask, erosion,
#> erosion.owin, erosion.ppp, erosion.psp, erosionAny, eval.im,
#> even.breaks.owin, ewcdf, exactdt, exactPdt, existsSpatstatVariable,
#> expandSpecialLists, extrapolate.psp, fakemaintitle, fardist,
#> fardist.owin, fardist.ppp, fft2D, fftwAvailable, fillNA, flipxy,
#> flipxy.distfun, flipxy.im, flipxy.infline, flipxy.layered,
#> flipxy.owin, flipxy.ppp, flipxy.psp, flipxy.tess, flipxypolygon,
#> format.numberwithunit, fourierbasis, fourierbasisraw, Frame,
#> Frame.default, Frame<-, Frame<-.default, Frame<-.im, Frame<-.owin,
#> Frame<-.ppp, framebottomleft, funxy, gammabreaks, genericNNdistBy,
#> getfields, getlastshift, getSpatstatVariable, grid1index,
#> gridcenters, gridcentres, gridindex, gridweights, grow.box3,
#> grow.boxx, grow.mask, grow.rectangle, grow.simplepanel, Halton,
#> Hammersley, handle.r.b.args, harmonise, harmonise.im,
#> harmonise.owin, harmonise.unitname, harmonize, harmonize.im,
#> harmonize.owin, harmonize.unitname, has.close, has.close.default,
#> has.close.pp3, has.close.ppp, head.hyperframe, head.ppp, head.ppx,
#> head.psp, head.tess, hexagon, hexgrid, hextess, hist.funxy,
#> hist.im, hotrod, hsvim, hsvNA, hyperframe, IdenticalRowPair,
#> IdenticalRows, identify.ppp, identify.psp, idorempty, im, im.apply,
#> image.im, image.imlist, image.listof, imagelistOp, imageOp, imcov,
#> incircle, infline, inpoint, inradius, inside.arc, inside.boxx,
#> inside.owin, integral, integral.im, intensity, intensity.ppp,
#> intensity.ppx, intensity.psp, intensity.quadratcount,
#> intensity.splitppp, interp.colourmap, interp.colours, interp.im,
#> interpretAsOrigin, intersect.owin, intersect.tess, intX.owin,
#> intX.xypolygon, intY.owin, intY.xypolygon, invoke.symbolmap,
#> invokeColourmapRule, is.col.argname, is.colour, is.connected,
#> is.connected.default, is.connected.ppp, is.convex, is.data,
#> is.empty, is.empty.default, is.empty.owin, is.empty.ppp,
#> is.empty.psp, is.fv, is.grey, is.hyperframe, is.im, is.imlist,
#> is.infline, is.linim, is.lpp, is.marked, is.marked.default,
#> is.marked.ppp, is.marked.psp, is.marked.quad, is.mask,
#> is.multitype, is.multitype.default, is.multitype.ppp,
#> is.multitype.quad, is.owin, is.polygonal, is.pp3, is.ppp,
#> is.ppplist, is.ppx, is.psp, is.quad, is.rectangle, is.sob,
#> is.solist, is.subset.owin, is.tess, is.vanilla, layered,
#> layerplotargs, layerplotargs<-, layout.boxes, lengths_psp,
#> levels.im, levels<-.im, levelsAsFactor, levelset, listof,
#> logi.dummy, lookup.im, lut, majorminorversion, make.even.breaks,
#> makeunitname, mark.scale.default, markappend, markappendop,
#> markcbind, markformat, markformat.default, markformat.ppp,
#> markformat.ppx, markformat.psp, markreplicateop, marks,
#> marks.default, marks.ppp, marks.ppx, marks.psp, marks.quad,
#> marks.tess, marks<-, marks<-.ppp, marks<-.ppx, marks<-.psp,
#> marks<-.tess, markspace.integral, markstat, marksubset,
#> marksubsetop, markvaluetype, mask2df, matchingdist, Math.im,
#> Math.imlist, maxflow, maxnndist, mean.im, meanX.owin, meanY.owin,
#> median.im, mergeLevels, midpoints.psp, MinimalTess, MinkowskiSum,
#> minnndist, multiplicity, multiplicity.data.frame,
#> multiplicity.default, multiplicity.ppp, multiplicity.ppx,
#> multiplicityNumeric, multiply.only.finite.entries, n.quad,
#> na.handle.im, names.hyperframe, names<-.hyperframe, nearest.pixel,
#> nearest.raster.point, nearest.valid.pixel, nearestsegment,
#> nearestValue, nestsplit, nncross, nncross.default, nncross.pp3,
#> nncross.ppp, nncross.ppx, nndist, nndist.default, nndist.pp3,
#> nndist.ppp, nndist.ppx, nndist.psp, nnfun, nnfun.ppp, nnfun.psp,
#> nnmap, nnmark, nnwhich, nnwhich.default, nnwhich.pp3, nnwhich.ppp,
#> nnwhich.ppx, nobjects, nobjects.ppp, nobjects.ppx, nobjects.psp,
#> nobjects.tess, npoints, npoints.pp3, npoints.ppp, npoints.ppx,
#> nsegments, nsegments.psp, numberwithunit, numeric.columns,
#> nvertices, nvertices.default, nvertices.owin, onearrow, onecolumn,
#> opening, opening.owin, opening.ppp, opening.psp, Ops.im,
#> Ops.imlist, overlap.owin, owin, owin2polypath, owinpoly2mask,
#> owinpolycheck, packupNNdata, padimage, pairdist, pairdist.default,
#> pairdist.pp3, pairdist.ppp, pairdist.ppx, pairdist.psp,
#> paletteindex, param.quad, parbreak, perimeter, periodify,
#> periodify.owin, periodify.ppp, periodify.psp, persp.funxy,
#> persp.im, perspContour, perspLines, perspPoints, perspSegments,
#> pickoption, pixelcentres, pixellate, pixellate.owin, pixellate.ppp,
#> pixellate.psp, pixelquad, plan.legend.layout, plot.anylist,
#> plot.barplotdata, plot.colourmap, plot.funxy, plot.hyperframe,
#> plot.im, plot.imlist, plot.indicfun, plot.infline, plot.layered,
#> plot.listof, plot.onearrow, plot.owin, plot.pp3, plot.ppp,
#> plot.pppmatching, plot.ppx, plot.psp, plot.quad, plot.quadratcount,
#> plot.solist, plot.splitppp, plot.symbolmap, plot.tess,
#> plot.textstring, plot.texturemap, plot.yardstick, plot3Dpoints,
#> plotEachLayer, plotPolygonBdry, plotWidthMap, pointgrid,
#> pointsOnLines, pointweights, polartess, polytileareaEngine, pp3,
#> ppllengine, ppp, pppdist, pppdist.mat, pppdist.prohorov,
#> pppmatching, ppsubset, ppx, prepareTitle, print.anylist,
#> print.box3, print.boxx, print.colourmap, print.distfun,
#> print.ewcdf, print.funxy, print.hyperframe, print.im,
#> print.indicfun, print.infline, print.layered, print.lut,
#> print.nnfun, print.numberwithunit, print.onearrow, print.owin,
#> print.pp3, print.ppp, print.pppmatching, print.ppx, print.psp,
#> print.quad, print.simplepanel, print.solist, print.splitppp,
#> print.splitppx, print.summary.distfun, print.summary.funxy,
#> print.summary.hyperframe, print.summary.im, print.summary.listof,
#> print.summary.logiquad, print.summary.lut, print.summary.owin,
#> print.summary.pp3, print.summary.ppp, print.summary.psp,
#> print.summary.quad, print.summary.solist, print.summary.splitppp,
#> print.summary.splitppx, print.summary.unitname, print.symbolmap,
#> print.tess, print.textstring, print.texturemap, print.timed,
#> print.unitname, print.yardstick, progressreport, project2segment,
#> project2set, project3Dhom, psp, putlastshift, putSpatstatVariable,
#> qtPrepareCoordinate, quad, quadratcount, quadratcount.ppp,
#> quadratcount.splitppp, quadrats, quadscheme, quadscheme.logi,
#> quadscheme.replicated, quadscheme.spatial, quantess, quantess.im,
#> quantess.owin, quantess.ppp, quantile.ewcdf, quantile.im, raster.x,
#> raster.xy, raster.y, rasterfilter, rastersample, rasterx.im,
#> rasterx.mask, rasterxy.im, rasterxy.mask, rastery.im, rastery.mask,
#> rbind.hyperframe, rebound, rebound.im, rebound.owin, rebound.ppp,
#> rebound.psp, recognise.spatstat.type, rectdistmap,
#> rectquadrat.breaks, rectquadrat.countEngine, redraw.simplepanel,
#> reflect, reflect.default, reflect.distfun, reflect.im,
#> reflect.infline, reflect.layered, reflect.tess, regularpolygon,
#> relevel.im, relevel.ppp, relevel.ppx, repair.image.xycoords,
#> repair.old.factor.image, requireversion, rescale, rescale.distfun,
#> rescale.im, rescale.layered, rescale.owin, rescale.ppp,
#> rescale.psp, rescale.unitname, rescue.rectangle,
#> reset.spatstat.options, restrict.mask, reversePolyclipArgs,
#> rgb2hex, rgb2hsva, rgbim, rgbNA, ripras, rjitter, rlinegrid,
#> rotate, rotate.distfun, rotate.im, rotate.infline, rotate.layered,
#> rotate.owin, rotate.ppp, rotate.psp, rotate.tess, rotxy,
#> rotxypolygon, round.pp3, round.ppp, round.ppx, rounding,
#> rounding.default, rounding.pp3, rounding.ppp, rounding.ppx,
#> row.names.hyperframe, row.names<-.hyperframe, rQuasi, rsyst,
#> ruletextline, run.simplepanel, runifrect, safedeldir, safelookup,
#> samecolour, scalardilate, scalardilate.breakpts,
#> scalardilate.default, scalardilate.diagramobj,
#> scalardilate.distfun, scalardilate.im, scalardilate.layered,
#> scalardilate.owin, scalardilate.ppp, scalardilate.psp,
#> scalardilate.tess, scaletointerval, scaletointerval.default,
#> scaletointerval.im, scanpp, selfcrossing.psp, selfcut.psp,
#> sessionLibs, setcov, setmarks, setminus.owin, shift,
#> shift.diagramobj, shift.distfun, shift.im, shift.infline,
#> shift.layered, shift.owin, shift.ppp, shift.psp,
#> shift.quadratcount, shift.tess, shiftxy, shiftxypolygon, shortside,
#> shortside.box3, shortside.boxx, shortside.owin, sidelengths,
#> sidelengths.box3, sidelengths.boxx, sidelengths.owin, simplepanel,
#> simplify.owin, simulationresult, smudge, solapply, solist,
#> solutionset, sort.im, spatdim, spatstat.deldir.setopt,
#> spatstat.options, spatstat.xy.coords, spatstatDiagnostic,
#> split.hyperframe, split.im, split.ppp, split.ppx,
#> split<-.hyperframe, split<-.ppp, spokes, square,
#> store.versionstring.spatstat, str.hyperframe, stratrand,
#> subset.hyperframe, subset.pp3, subset.ppp, subset.ppx, subset.psp,
#> summary.anylist, summary.distfun, summary.funxy,
#> summary.hyperframe, summary.im, Summary.im, Summary.imlist,
#> summary.listof, summary.logiquad, summary.lut, summary.owin,
#> summary.pp3, summary.ppp, summary.pppmatching, summary.ppx,
#> summary.psp, summary.quad, summary.solist, summary.splitppp,
#> summary.splitppx, summary.unitname, superimpose,
#> superimpose.default, superimpose.ppp, superimpose.ppplist,
#> superimpose.psp, superimpose.splitppp, superimposeMarks, symbolmap,
#> symbolmapdomain, symbolmaptype, tail.hyperframe, tail.ppp,
#> tail.ppx, tail.psp, tail.tess, tess, test.crossing.psp,
#> test.selfcrossing.psp, text.ppp, text.psp, textstring, texturemap,
#> textureplot, tile.areas, tilecentroids, tileindex, tilenames,
#> tilenames.tess, tilenames<-, tilenames<-.tess, tiles, tiles.empty,
#> timed, timeTaken, to.grey, to.opaque, to.saturated, to.transparent,
#> transmat, trianglediameters, triangulate.owin, trim.mask,
#> trim.rectangle, tweak.closepairs, tweak.colourmap, union.owin,
#> union.quad, unique.ppp, unique.ppx, uniquemap,
#> uniquemap.data.frame, uniquemap.default, uniquemap.lpp,
#> uniquemap.matrix, uniquemap.ppp, uniquemap.ppx, unit.square,
#> unitname, unitname.box3, unitname.boxx, unitname.default,
#> unitname.im, unitname.owin, unitname.pp3, unitname.ppp,
#> unitname.ppx, unitname.psp, unitname.quad, unitname.tess,
#> unitname<-, unitname<-.box3, unitname<-.boxx, unitname<-.default,
#> unitname<-.im, unitname<-.owin, unitname<-.pp3, unitname<-.ppp,
#> unitname<-.ppx, unitname<-.psp, unitname<-.quad, unitname<-.tess,
#> unmark, unmark.ppp, unmark.ppx, unmark.psp, unmark.splitppp,
#> unmark.tess, unnormdensity, unstack.layered, unstack.ppp,
#> unstack.psp, unstack.solist, unstack.tess, unstackFilter,
#> update.im, update.symbolmap, validate.mask, validate.quad,
#> validradius, vdCorput, venn.tess, verifyclass,
#> versioncurrency.spatstat, versionstring.spatstat, vertices,
#> vertices.owin, veryunique, volume, volume.box3, volume.boxx,
#> volume.owin, w.quad, warn.once, waxlyrical, weighted.median,
#> weighted.quantile, weighted.var, where.max, where.min,
#> whichhalfplane, whist, Window, Window.distfun, Window.funxy,
#> Window.im, Window.layered, Window.nnfun, Window.ppp, Window.psp,
#> Window.quad, Window.quadratcount, Window.tess, Window<-,
#> Window<-.im, Window<-.ppp, Window<-.psp, with.hyperframe, x.quad,
#> xtfrm.im, xy.grid, xypolygon2psp, xypolyselfint, y.quad, yardstick,
#> zapsmall.im, ZeroValue, ZeroValue.im
library(sp)
library(remotes
Create sfc_POLYGON
object
# Create SpatialPolygons
x_coords <- c(-60,-60,-62,-61,-62,-60)
y_coords <- c(20,25,25,22,20,20)
spPoly <- Polygon(cbind(x_coords,y_coords))
spPolys <- Polygons(list(spPoly), ID = "A")
spPolys <- SpatialPolygons(list(spPolys))
# Convert to 'sfc_POLYGON'
sfPolys <- st_as_sf(spPolys)
# SpatialPolygons
plot(sfPolys)
Convet sfc_POLYGONS
object to owin
object with spatstat
and spatstat.geom
# spatstat v1.64-1
test1 <- spatstat::as.owin(st_geometry(sfPolys))
plot(test1) # owin similar to polygon
# spatstat.geom v1.65-5
test2 <- spatstat.geom::as.owin(st_geometry(sfPolys))
plot(test2) # owin similar to bbox
The packages create two different owin
objects.
Next, remove CRAN sf
and install your fork of sf
# Remove CRAN 'sf'
remove.packages("sf")
#> Removing package from '/Library/Frameworks/R.framework/Versions/4.0/Resources/library'
#> (as 'lib' is unspecified)
# Install Rubak for of 'sf'
devtools::install_github("rubak/sf")
#> Registered S3 method overwritten by 'cli':
#> method from
#> print.boxx spatstat.geom
#> Using github PAT from envvar GITHUB_PAT
#> Downloading GitHub repo rubak/sf@HEAD
#>
#> checking for file ‘/private/var/folders/51/r35_6_fj7lbd_ctbns2x49ccm70cn8/T/RtmpxBH7EW/remotes9f806c974a0/rubak-sf-e71a7d4/DESCRIPTION’ ... ✓ checking for file ‘/private/var/folders/51/r35_6_fj7lbd_ctbns2x49ccm70cn8/T/RtmpxBH7EW/remotes9f806c974a0/rubak-sf-e71a7d4/DESCRIPTION’
#> ─ preparing ‘sf’:
#> checking DESCRIPTION meta-information ... ✓ checking DESCRIPTION meta-information
#> ─ cleaning src
#> ─ running ‘cleanup’
#> ─ checking for LF line-endings in source and make files and shell scripts
#> ─ checking for empty or unneeded directories
#> ─ building ‘sf_0.9-8.tar.gz’
#> Warning: invalid uid value replaced by that for user 'nobody'
#> Warning: invalid gid value replaced by that for user 'nobody'
#>
#>
# Load Rubak fork of 'sf'
library(sf)
Re-run example
# Re-run example
## Create SpatialPolygons
x_coords <- c(-60,-60,-62,-61,-62,-60)
y_coords <- c(20,25,25,22,20,20)
spPoly <- Polygon(cbind(x_coords,y_coords))
spPolys <- Polygons(list(spPoly), ID = "A")
spPolys <- SpatialPolygons(list(spPolys))
# Convert to 'sfc_POLYGON'
sfPolys <- st_as_sf(spPolys)
# SpatialPolygons
plot(sfPolys)
# spatstat v1.64-1
test1 <- spatstat::as.owin(st_geometry(sfPolys))
plot(test1) # owin similar to polygon
# spatstat.geom v1.65-5
test2 <- spatstat.geom::as.owin(st_geometry(sfPolys))
plot(test2) # owin similar to bbox
No change. (Different from my run yesterday where both produced a rectangle)
Here is my session info:
## Session Info
sessionInfo()
#> R version 4.0.3 (2020-10-10)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Catalina 10.15.7
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] sp_1.4-5 spatstat.geom_1.65-5 spatstat_1.64-1
#> [4] rpart_4.1-15 nlme_3.1-151 spatstat.data_1.7-0
#> [7] sf_0.9-8
#>
#> loaded via a namespace (and not attached):
#> [1] Rcpp_1.0.6 lattice_0.20-41 deldir_0.2-9
#> [4] prettyunits_1.1.1 class_7.3-18 ps_1.5.0
#> [7] assertthat_0.2.1 rprojroot_2.0.2 digest_0.6.27
#> [10] R6_2.5.0 backports_1.2.1 reprex_1.0.0
#> [13] evaluate_0.14 e1071_1.7-4 tensor_1.5
#> [16] highr_0.8 pillar_1.4.7 rlang_0.4.10
#> [19] curl_4.3 callr_3.5.1 Matrix_1.3-2
#> [22] goftest_1.2-2 rmarkdown_2.6 styler_1.3.2
#> [25] desc_1.2.0 devtools_2.3.2 splines_4.0.3
#> [28] stringr_1.4.0 polyclip_1.10-0 compiler_4.0.3
#> [31] xfun_0.20 pkgconfig_2.0.3 pkgbuild_1.2.0
#> [34] mgcv_1.8-33 htmltools_0.5.1.1 tidyselect_1.1.0
#> [37] tibble_3.0.6 crayon_1.4.0 dplyr_1.0.4
#> [40] withr_2.4.1 grid_4.0.3 lifecycle_0.2.0
#> [43] DBI_1.1.1 magrittr_2.0.1 units_0.6-7
#> [46] KernSmooth_2.23-18 cli_2.3.0 stringi_1.5.3
#> [49] cachem_1.0.2 remotes_2.2.0 fs_1.5.0
#> [52] testthat_3.0.1 ellipsis_0.3.1 generics_0.1.0
#> [55] vctrs_0.3.6 spatstat.utils_2.0-0 tools_4.0.3
#> [58] glue_1.4.2 purrr_0.3.4 processx_3.4.5
#> [61] abind_1.4-5 pkgload_1.1.0 fastmap_1.1.0
#> [64] yaml_2.2.1 spatstat.sparse_1.2-0 sessioninfo_1.1.1
#> [67] classInt_0.4-3 memoise_2.0.0 knitr_1.31
#> [70] usethis_2.0.0
Created on 2021-02-06 by the reprex package (v1.0.0)
Running your example: https://github.com/r-spatial/sf/pull/1596#issuecomment-774343437
I start with removing any previously installed sf
, spatstat
, and spatstat.geom
# Remove packages
remove.packages("sf")
#> Removing package from '/Library/Frameworks/R.framework/Versions/4.0/Resources/library'
#> (as 'lib' is unspecified)
remove.packages("spatstat")
#> Removing package from '/Library/Frameworks/R.framework/Versions/4.0/Resources/library'
#> (as 'lib' is unspecified)
remove.packages("spatstat.geom")
#> Removing package from '/Library/Frameworks/R.framework/Versions/4.0/Resources/library'
#> (as 'lib' is unspecified)
Clean install of sf
, spatstat
, and spatstat.geom
from CRAN
# Install from CRAN
install.packages("sf")
#>
#> The downloaded binary packages are in
#> /var/folders/51/r35_6_fj7lbd_ctbns2x49ccm70cn8/T//RtmpQHHrs8/downloaded_packages
install.packages("spatstat")
#>
#> The downloaded binary packages are in
#> /var/folders/51/r35_6_fj7lbd_ctbns2x49ccm70cn8/T//RtmpQHHrs8/downloaded_packages
install.packages("spatstat.geom")
#>
#> The downloaded binary packages are in
#> /var/folders/51/r35_6_fj7lbd_ctbns2x49ccm70cn8/T//RtmpQHHrs8/downloaded_packages
Load the necessary pacakges for the example
library(sf)
#> Linking to GEOS 3.8.1, GDAL 3.1.4, PROJ 6.3.1
library(spatstat)
#> Loading required package: spatstat.data
#> Loading required package: nlme
#> Loading required package: rpart
#>
#> spatstat 1.64-1 (nickname: 'Help you I can, yes!')
#> For an introduction to spatstat, type 'beginner'
#>
#> Note: spatstat version 1.64-1 is out of date by more than 9 months; we recommend upgrading to the latest version.
library(spatstat.geom)
#> Registered S3 methods overwritten by 'spatstat.sparse':
#> method from
#> Complex.sparse3Darray spatstat
#> Math.sparse3Darray spatstat
#> Ops.sparse3Darray spatstat
#> Summary.sparse3Darray spatstat
#> anyNA.sparse3Darray spatstat
#> aperm.sparse3Darray spatstat
#> as.array.sparse3Darray spatstat
#> dimnames.sparse3Darray spatstat
#> dim.sparse3Darray spatstat
#> print.sparse3Darray spatstat
#> [.sparse3Darray
#> dimnames<-.sparse3Darray spatstat
#> dim<-.sparse3Darray spatstat
#> [<-.sparse3Darray spatstat
#> Registered S3 methods overwritten by 'spatstat.geom':
#> method from
#> Complex.im spatstat
#> Complex.imlist spatstat
#> Math.im spatstat
#> Math.imlist spatstat
#> mean.im spatstat
#> median.im spatstat
#> Ops.im spatstat
#> Ops.imlist spatstat
#> Summary.im spatstat
#> Summary.imlist spatstat
#> $.hyperframe spatstat
#> anyDuplicated.ppp spatstat
#> anyDuplicated.ppx spatstat
#> [.anylist spatstat
#> anyNA.im spatstat
#> as.array.im spatstat
#> as.character.unitname spatstat
#> as.data.frame.hyperframe spatstat
#> as.data.frame.im spatstat
#> as.data.frame.owin spatstat
#> as.data.frame.ppp spatstat
#> as.data.frame.ppx spatstat
#> as.data.frame.psp spatstat
#> as.data.frame.tess spatstat
#> as.double.im spatstat
#> as.function.im spatstat
#> as.function.owin spatstat
#> as.function.tess spatstat
#> as.list.hyperframe spatstat
#> as.matrix.im spatstat
#> as.matrix.owin spatstat
#> as.matrix.ppx spatstat
#> by.im spatstat
#> by.ppp spatstat
#> cbind.hyperframe spatstat
#> contour.funxy spatstat
#> contour.im spatstat
#> contour.imlist spatstat
#> contour.listof spatstat
#> cut.im spatstat
#> cut.ppp spatstat
#> [.diagramobj spatstat
#> dim.hyperframe spatstat
#> dim.im spatstat
#> dimnames.hyperframe spatstat
#> dim.owin spatstat
#> duplicated.ppp spatstat
#> duplicated.ppx spatstat
#> edit.hyperframe spatstat
#> edit.im spatstat
#> edit.ppp
#> edit.psp spatstat
#> format.numberwithunit spatstat
#> head.hyperframe spatstat
#> head.ppp spatstat
#> head.ppx spatstat
#> head.psp spatstat
#> head.tess spatstat
#> hist.funxy spatstat
#> hist.im spatstat
#> [.hyperframe spatstat
#> identify.ppp spatstat
#> identify.psp spatstat
#> [.im
#> image.im
#> image.imlist spatstat
#> image.listof spatstat
#> [.layered spatstat
#> levels.im spatstat
#> names.hyperframe spatstat
#> [.owin spatstat
#> persp.funxy spatstat
#> persp.im
#> plot.anylist
#> plot.barplotdata spatstat
#> plot.colourmap
#> plot.funxy spatstat
#> plot.hyperframe spatstat
#> plot.im
#> plot.imlist
#> plot.indicfun spatstat
#> plot.infline spatstat
#> plot.layered spatstat
#> plot.listof
#> plot.onearrow spatstat
#> plot.owin spatstat
#> plot.pp3 spatstat
#> plot.ppp
#> plot.pppmatching spatstat
#> plot.ppx spatstat
#> plot.psp spatstat
#> plot.quad spatstat
#> plot.quadratcount spatstat
#> plot.solist
#> plot.splitppp spatstat
#> plot.symbolmap spatstat
#> plot.tess
#> plot.textstring spatstat
#> plot.texturemap
#> plot.yardstick
#> [.pp3 spatstat
#> [.ppp spatstat
#> [.ppx spatstat
#> print.anylist spatstat
#> print.box3 spatstat
#> print.boxx spatstat
#> print.colourmap spatstat
#> print.distfun spatstat
#> print.ewcdf spatstat
#> print.funxy spatstat
#> print.hyperframe spatstat
#> print.im spatstat
#> print.indicfun spatstat
#> print.infline spatstat
#> print.layered spatstat
#> print.lut spatstat
#> print.nnfun spatstat
#> print.numberwithunit spatstat
#> print.onearrow spatstat
#> print.owin spatstat
#> print.pp3 spatstat
#> print.ppp spatstat
#> print.pppmatching spatstat
#> print.ppx spatstat
#> print.psp spatstat
#> print.quad spatstat
#> print.simplepanel spatstat
#> print.solist spatstat
#> print.splitppp spatstat
#> print.splitppx spatstat
#> print.summary.distfun spatstat
#> print.summary.funxy spatstat
#> print.summary.hyperframe spatstat
#> print.summary.im spatstat
#> print.summary.listof spatstat
#> print.summary.logiquad spatstat
#> print.summary.lut spatstat
#> print.summary.owin spatstat
#> print.summary.pp3 spatstat
#> print.summary.ppp spatstat
#> print.summary.psp spatstat
#> print.summary.quad
#> print.summary.solist spatstat
#> print.summary.splitppp spatstat
#> print.summary.splitppx spatstat
#> print.summary.unitname spatstat
#> print.symbolmap spatstat
#> print.tess spatstat
#> print.textstring spatstat
#> print.texturemap spatstat
#> print.timed spatstat
#> print.unitname spatstat
#> print.yardstick spatstat
#> [.psp spatstat
#> [.quad spatstat
#> quantile.ewcdf spatstat
#> quantile.im spatstat
#> rbind.hyperframe spatstat
#> relevel.im spatstat
#> relevel.ppp spatstat
#> relevel.ppx spatstat
#> round.pp3 spatstat
#> round.ppp spatstat
#> round.ppx spatstat
#> row.names.hyperframe spatstat
#> [.solist spatstat
#> sort.im spatstat
#> split.hyperframe
#> split.im spatstat
#> [.splitppp spatstat
#> split.ppp spatstat
#> split.ppx spatstat
#> [.splitppx spatstat
#> str.hyperframe spatstat
#> subset.hyperframe spatstat
#> subset.pp3 spatstat
#> subset.ppp spatstat
#> subset.ppx spatstat
#> subset.psp spatstat
#> summary.anylist spatstat
#> summary.distfun spatstat
#> summary.funxy spatstat
#> summary.hyperframe spatstat
#> summary.im spatstat
#> summary.listof spatstat
#> summary.logiquad spatstat
#> summary.lut spatstat
#> summary.owin spatstat
#> summary.pp3 spatstat
#> summary.ppp spatstat
#> summary.pppmatching spatstat
#> summary.ppx spatstat
#> summary.psp spatstat
#> summary.quad
#> summary.solist spatstat
#> summary.splitppp spatstat
#> summary.splitppx spatstat
#> summary.unitname spatstat
#> tail.hyperframe spatstat
#> tail.ppp spatstat
#> tail.ppx spatstat
#> tail.psp spatstat
#> tail.tess spatstat
#> [.tess spatstat
#> text.ppp spatstat
#> text.psp spatstat
#> unique.ppp spatstat
#> unique.ppx spatstat
#> unstack.layered spatstat
#> unstack.ppp spatstat
#> unstack.psp spatstat
#> unstack.solist spatstat
#> unstack.tess spatstat
#> update.im spatstat
#> update.symbolmap spatstat
#> with.hyperframe spatstat
#> xtfrm.im spatstat
#> $<-.hyperframe spatstat
#> [<-.anylist spatstat
#> dimnames<-.hyperframe spatstat
#> [<-.hyperframe spatstat
#> [<-.im spatstat
#> [<-.layered spatstat
#> [[<-.layered spatstat
#> levels<-.im spatstat
#> [<-.listof spatstat
#> names<-.hyperframe spatstat
#> [<-.ppp spatstat
#> row.names<-.hyperframe spatstat
#> [<-.solist spatstat
#> split<-.hyperframe spatstat
#> [<-.splitppp spatstat
#> split<-.ppp spatstat
#> [<-.splitppx spatstat
#> [<-.tess spatstat
#> spatstat.geom 1.65-5
#>
#> Attaching package: 'spatstat.geom'
#> The following objects are masked from 'package:spatstat':
#>
#> [.anylist, [.diagramobj, [.hyperframe, [.im, [.layered, [.owin,
#> [.pp3, [.ppp, [.ppx, [.psp, [.quad, [.solist, [.splitppp,
#> [.splitppx, [.tess, [[<-.layered, [<-.anylist, [<-.hyperframe,
#> [<-.im, [<-.layered, [<-.listof, [<-.ppp, [<-.solist, [<-.splitppp,
#> [<-.splitppx, [<-.tess, %(-)%, %(+)%, %mapp%, %mark%, %mrep%,
#> %msub%, %unit%, $.hyperframe, $<-.hyperframe, acedist.noshow,
#> acedist.show, add.texture, affine, affine.distfun, affine.im,
#> affine.layered, affine.owin, affine.ppp, affine.psp, affine.tess,
#> affinexy, affinexypolygon, allElementsIdentical, angles.psp,
#> anycrossing.psp, anyDuplicated.ppp, anyDuplicated.ppx, anylapply,
#> anylist, anyNA.im, append.psp, applynbd, applyPolyclipArgs,
#> applytolayers, area, area.default, area.owin, areaGain,
#> areaGain.diri, areaGain.grid, areaLoss, areaLoss.diri,
#> areaLoss.grid, areaLoss.poly, as.anylist, as.array.im, as.box3,
#> as.boxx, as.breakpts, as.character.unitname,
#> as.data.frame.hyperframe, as.data.frame.im, as.data.frame.owin,
#> as.data.frame.ppp, as.data.frame.ppx, as.data.frame.psp,
#> as.data.frame.tess, as.double.im, as.function.im, as.function.owin,
#> as.function.tess, as.hyperframe, as.hyperframe.anylist,
#> as.hyperframe.data.frame, as.hyperframe.default,
#> as.hyperframe.hyperframe, as.hyperframe.listof, as.hyperframe.ppx,
#> as.im, as.im.data.frame, as.im.default, as.im.distfun,
#> as.im.expression, as.im.function, as.im.funxy, as.im.im,
#> as.im.matrix, as.im.nnfun, as.im.owin, as.im.ppp, as.im.tess,
#> as.imlist, as.layered, as.layered.default, as.layered.listof,
#> as.layered.ppp, as.layered.solist, as.layered.splitppp,
#> as.list.hyperframe, as.listof, as.mask, as.mask.psp, as.matrix.im,
#> as.matrix.owin, as.matrix.ppx, as.owin, as.owin.boxx,
#> as.owin.data.frame, as.owin.default, as.owin.distfun,
#> as.owin.funxy, as.owin.im, as.owin.layered, as.owin.nnfun,
#> as.owin.owin, as.owin.ppp, as.owin.psp, as.owin.quad,
#> as.owin.quadratcount, as.owin.tess, as.polygonal, as.ppp,
#> as.ppp.data.frame, as.ppp.default, as.ppp.matrix, as.ppp.ppp,
#> as.ppp.psp, as.ppp.quad, as.ppplist, as.psp, as.psp.data.frame,
#> as.psp.default, as.psp.matrix, as.psp.owin, as.psp.psp,
#> as.rectangle, as.solist, as.tess, as.tess.im, as.tess.list,
#> as.tess.owin, as.tess.quadratcount, as.tess.tess, as.unitname,
#> AsymmDistance.psp, avenndist, bbEngine, bdist.pixels, bdist.points,
#> bdist.tiles, bdry.mask, beachcolourmap, beachcolours, border,
#> bounding.box.xy, bounding.box3, boundingbox, boundingbox.default,
#> boundingbox.im, boundingbox.linnet, boundingbox.lpp,
#> boundingbox.owin, boundingbox.ppp, boundingbox.psp,
#> boundingbox.solist, boundingcentre, boundingcentre.owin,
#> boundingcentre.ppp, boundingcircle, boundingcircle.owin,
#> boundingcircle.ppp, boundingradius, boundingradius.owin,
#> boundingradius.ppp, box3, boxx, break.holes, breakpts,
#> breakpts.from.r, by.im, by.ppp, cartesian, cbind.hyperframe,
#> cellmiddles, centroid.owin, check.arc, check.finespacing,
#> check.hist.lengths, checkbigmatrix, checkfields, chop.tess,
#> circumradius, circumradius.owin, circumradius.ppp, circunion,
#> clear.simplepanel, clickbox, clickdist, clickpoly, clickppp,
#> clip.infline, clip.psp, clippoly.psp, cliprect.psp, closepairs,
#> closepairs.pp3, closepairs.ppp, closethresh, closetriples, closing,
#> closing.owin, closing.ppp, closing.psp, cobble.xy, codetime,
#> coerce.marks.numeric, col.args.to.grey, col2hex, colourmap,
#> colouroutputs, colouroutputs<-, commonGrid, commonPolyclipArgs,
#> compatible, compatible.im, compatible.unitname, complement.owin,
#> complementarycolour, Complex.im, Complex.imlist, concatxy,
#> conform.imagelist, connected, connected.im, connected.owin,
#> connected.pp3, connected.ppp, connected.tess, contour.funxy,
#> contour.im, contour.imlist, contour.listof, convexhull,
#> convexhull.xy, convexify, convolve.im, coords, coords.ppp,
#> coords.ppx, coords.quad, coords<-, coords<-.ppp, coords<-.ppx,
#> corners, countingweights, covering, crossdist, crossdist.default,
#> crossdist.pp3, crossdist.ppp, crossdist.ppx, crossdist.psp,
#> crossing.psp, crosspairquad, crosspairs, crosspairs.pp3,
#> crosspairs.ppp, cut.im, cut.ppp, default.dummy, default.n.tiling,
#> default.ntile, delaunay, delaunayDistance, deltametric,
#> dflt.redraw, diagramobj, diameter, diameter.box3, diameter.boxx,
#> diameter.owin, dilated.areas, dilation, dilation.owin,
#> dilation.ppp, dilation.psp, dilationAny, dim.hyperframe, dim.im,
#> dim.owin, dimnames.hyperframe, dimnames<-.hyperframe, dirichlet,
#> dirichletAreas, dirichletEdges, dirichletVertices,
#> dirichletWeights, disc, discpartarea, discretise, discs,
#> dist2dpath, distfun, distfun.owin, distfun.ppp, distfun.psp,
#> distmap, distmap.owin, distmap.ppp, distmap.psp, do.as.im,
#> do.call.plotfun, domain, domain.distfun, domain.funxy, domain.im,
#> domain.layered, domain.nnfun, domain.pp3, domain.ppp, domain.ppx,
#> domain.psp, domain.quad, domain.quadratcount, domain.tess,
#> drawSignedPoly, duplicated.ppp, duplicated.ppx, edges,
#> edges2triangles, edges2vees, edit.hyperframe, edit.im, edit.ppp,
#> edit.psp, ellipse, emptywindow, endpoints.psp, equalpairs.quad,
#> equals.quad, equalsfun.quad, eroded.areas, eroded.volumes,
#> eroded.volumes.box3, eroded.volumes.boxx, erodemask, erosion,
#> erosion.owin, erosion.ppp, erosion.psp, erosionAny, eval.im,
#> even.breaks.owin, ewcdf, exactdt, exactPdt, existsSpatstatVariable,
#> expandSpecialLists, extrapolate.psp, fakemaintitle, fardist,
#> fardist.owin, fardist.ppp, fft2D, fftwAvailable, fillNA, flipxy,
#> flipxy.distfun, flipxy.im, flipxy.infline, flipxy.layered,
#> flipxy.owin, flipxy.ppp, flipxy.psp, flipxy.tess, flipxypolygon,
#> format.numberwithunit, fourierbasis, fourierbasisraw, Frame,
#> Frame.default, Frame<-, Frame<-.default, Frame<-.im, Frame<-.owin,
#> Frame<-.ppp, framebottomleft, funxy, gammabreaks, genericNNdistBy,
#> getfields, getlastshift, getSpatstatVariable, grid1index,
#> gridcenters, gridcentres, gridindex, gridweights, grow.box3,
#> grow.boxx, grow.mask, grow.rectangle, grow.simplepanel, Halton,
#> Hammersley, handle.r.b.args, harmonise, harmonise.im,
#> harmonise.owin, harmonise.unitname, harmonize, harmonize.im,
#> harmonize.owin, harmonize.unitname, has.close, has.close.default,
#> has.close.pp3, has.close.ppp, head.hyperframe, head.ppp, head.ppx,
#> head.psp, head.tess, hexagon, hexgrid, hextess, hist.funxy,
#> hist.im, hotrod, hsvim, hsvNA, hyperframe, IdenticalRowPair,
#> IdenticalRows, identify.ppp, identify.psp, idorempty, im, im.apply,
#> image.im, image.imlist, image.listof, imagelistOp, imageOp, imcov,
#> incircle, infline, inpoint, inradius, inside.arc, inside.boxx,
#> inside.owin, integral, integral.im, intensity, intensity.ppp,
#> intensity.ppx, intensity.psp, intensity.quadratcount,
#> intensity.splitppp, interp.colourmap, interp.colours, interp.im,
#> interpretAsOrigin, intersect.owin, intersect.tess, intX.owin,
#> intX.xypolygon, intY.owin, intY.xypolygon, invoke.symbolmap,
#> invokeColourmapRule, is.col.argname, is.colour, is.connected,
#> is.connected.default, is.connected.ppp, is.convex, is.data,
#> is.empty, is.empty.default, is.empty.owin, is.empty.ppp,
#> is.empty.psp, is.fv, is.grey, is.hyperframe, is.im, is.imlist,
#> is.infline, is.linim, is.lpp, is.marked, is.marked.default,
#> is.marked.ppp, is.marked.psp, is.marked.quad, is.mask,
#> is.multitype, is.multitype.default, is.multitype.ppp,
#> is.multitype.quad, is.owin, is.polygonal, is.pp3, is.ppp,
#> is.ppplist, is.ppx, is.psp, is.quad, is.rectangle, is.sob,
#> is.solist, is.subset.owin, is.tess, is.vanilla, layered,
#> layerplotargs, layerplotargs<-, layout.boxes, lengths_psp,
#> levels.im, levels<-.im, levelsAsFactor, levelset, listof,
#> logi.dummy, lookup.im, lut, majorminorversion, make.even.breaks,
#> makeunitname, mark.scale.default, markappend, markappendop,
#> markcbind, markformat, markformat.default, markformat.ppp,
#> markformat.ppx, markformat.psp, markreplicateop, marks,
#> marks.default, marks.ppp, marks.ppx, marks.psp, marks.quad,
#> marks.tess, marks<-, marks<-.ppp, marks<-.ppx, marks<-.psp,
#> marks<-.tess, markspace.integral, markstat, marksubset,
#> marksubsetop, markvaluetype, mask2df, matchingdist, Math.im,
#> Math.imlist, maxflow, maxnndist, mean.im, meanX.owin, meanY.owin,
#> median.im, mergeLevels, midpoints.psp, MinimalTess, MinkowskiSum,
#> minnndist, multiplicity, multiplicity.data.frame,
#> multiplicity.default, multiplicity.ppp, multiplicity.ppx,
#> multiplicityNumeric, multiply.only.finite.entries, n.quad,
#> na.handle.im, names.hyperframe, names<-.hyperframe, nearest.pixel,
#> nearest.raster.point, nearest.valid.pixel, nearestsegment,
#> nearestValue, nestsplit, nncross, nncross.default, nncross.pp3,
#> nncross.ppp, nncross.ppx, nndist, nndist.default, nndist.pp3,
#> nndist.ppp, nndist.ppx, nndist.psp, nnfun, nnfun.ppp, nnfun.psp,
#> nnmap, nnmark, nnwhich, nnwhich.default, nnwhich.pp3, nnwhich.ppp,
#> nnwhich.ppx, nobjects, nobjects.ppp, nobjects.ppx, nobjects.psp,
#> nobjects.tess, npoints, npoints.pp3, npoints.ppp, npoints.ppx,
#> nsegments, nsegments.psp, numberwithunit, numeric.columns,
#> nvertices, nvertices.default, nvertices.owin, onearrow, onecolumn,
#> opening, opening.owin, opening.ppp, opening.psp, Ops.im,
#> Ops.imlist, overlap.owin, owin, owin2polypath, owinpoly2mask,
#> owinpolycheck, packupNNdata, padimage, pairdist, pairdist.default,
#> pairdist.pp3, pairdist.ppp, pairdist.ppx, pairdist.psp,
#> paletteindex, param.quad, parbreak, perimeter, periodify,
#> periodify.owin, periodify.ppp, periodify.psp, persp.funxy,
#> persp.im, perspContour, perspLines, perspPoints, perspSegments,
#> pickoption, pixelcentres, pixellate, pixellate.owin, pixellate.ppp,
#> pixellate.psp, pixelquad, plan.legend.layout, plot.anylist,
#> plot.barplotdata, plot.colourmap, plot.funxy, plot.hyperframe,
#> plot.im, plot.imlist, plot.indicfun, plot.infline, plot.layered,
#> plot.listof, plot.onearrow, plot.owin, plot.pp3, plot.ppp,
#> plot.pppmatching, plot.ppx, plot.psp, plot.quad, plot.quadratcount,
#> plot.solist, plot.splitppp, plot.symbolmap, plot.tess,
#> plot.textstring, plot.texturemap, plot.yardstick, plot3Dpoints,
#> plotEachLayer, plotPolygonBdry, plotWidthMap, pointgrid,
#> pointsOnLines, pointweights, polartess, polytileareaEngine, pp3,
#> ppllengine, ppp, pppdist, pppdist.mat, pppdist.prohorov,
#> pppmatching, ppsubset, ppx, prepareTitle, print.anylist,
#> print.box3, print.boxx, print.colourmap, print.distfun,
#> print.ewcdf, print.funxy, print.hyperframe, print.im,
#> print.indicfun, print.infline, print.layered, print.lut,
#> print.nnfun, print.numberwithunit, print.onearrow, print.owin,
#> print.pp3, print.ppp, print.pppmatching, print.ppx, print.psp,
#> print.quad, print.simplepanel, print.solist, print.splitppp,
#> print.splitppx, print.summary.distfun, print.summary.funxy,
#> print.summary.hyperframe, print.summary.im, print.summary.listof,
#> print.summary.logiquad, print.summary.lut, print.summary.owin,
#> print.summary.pp3, print.summary.ppp, print.summary.psp,
#> print.summary.quad, print.summary.solist, print.summary.splitppp,
#> print.summary.splitppx, print.summary.unitname, print.symbolmap,
#> print.tess, print.textstring, print.texturemap, print.timed,
#> print.unitname, print.yardstick, progressreport, project2segment,
#> project2set, project3Dhom, psp, putlastshift, putSpatstatVariable,
#> qtPrepareCoordinate, quad, quadratcount, quadratcount.ppp,
#> quadratcount.splitppp, quadrats, quadscheme, quadscheme.logi,
#> quadscheme.replicated, quadscheme.spatial, quantess, quantess.im,
#> quantess.owin, quantess.ppp, quantile.ewcdf, quantile.im, raster.x,
#> raster.xy, raster.y, rasterfilter, rastersample, rasterx.im,
#> rasterx.mask, rasterxy.im, rasterxy.mask, rastery.im, rastery.mask,
#> rbind.hyperframe, rebound, rebound.im, rebound.owin, rebound.ppp,
#> rebound.psp, recognise.spatstat.type, rectdistmap,
#> rectquadrat.breaks, rectquadrat.countEngine, redraw.simplepanel,
#> reflect, reflect.default, reflect.distfun, reflect.im,
#> reflect.infline, reflect.layered, reflect.tess, regularpolygon,
#> relevel.im, relevel.ppp, relevel.ppx, repair.image.xycoords,
#> repair.old.factor.image, requireversion, rescale, rescale.distfun,
#> rescale.im, rescale.layered, rescale.owin, rescale.ppp,
#> rescale.psp, rescale.unitname, rescue.rectangle,
#> reset.spatstat.options, restrict.mask, reversePolyclipArgs,
#> rgb2hex, rgb2hsva, rgbim, rgbNA, ripras, rjitter, rlinegrid,
#> rotate, rotate.distfun, rotate.im, rotate.infline, rotate.layered,
#> rotate.owin, rotate.ppp, rotate.psp, rotate.tess, rotxy,
#> rotxypolygon, round.pp3, round.ppp, round.ppx, rounding,
#> rounding.default, rounding.pp3, rounding.ppp, rounding.ppx,
#> row.names.hyperframe, row.names<-.hyperframe, rQuasi, rsyst,
#> ruletextline, run.simplepanel, runifrect, safedeldir, safelookup,
#> samecolour, scalardilate, scalardilate.breakpts,
#> scalardilate.default, scalardilate.diagramobj,
#> scalardilate.distfun, scalardilate.im, scalardilate.layered,
#> scalardilate.owin, scalardilate.ppp, scalardilate.psp,
#> scalardilate.tess, scaletointerval, scaletointerval.default,
#> scaletointerval.im, scanpp, selfcrossing.psp, selfcut.psp,
#> sessionLibs, setcov, setmarks, setminus.owin, shift,
#> shift.diagramobj, shift.distfun, shift.im, shift.infline,
#> shift.layered, shift.owin, shift.ppp, shift.psp,
#> shift.quadratcount, shift.tess, shiftxy, shiftxypolygon, shortside,
#> shortside.box3, shortside.boxx, shortside.owin, sidelengths,
#> sidelengths.box3, sidelengths.boxx, sidelengths.owin, simplepanel,
#> simplify.owin, simulationresult, smudge, solapply, solist,
#> solutionset, sort.im, spatdim, spatstat.deldir.setopt,
#> spatstat.options, spatstat.xy.coords, spatstatDiagnostic,
#> split.hyperframe, split.im, split.ppp, split.ppx,
#> split<-.hyperframe, split<-.ppp, spokes, square,
#> store.versionstring.spatstat, str.hyperframe, stratrand,
#> subset.hyperframe, subset.pp3, subset.ppp, subset.ppx, subset.psp,
#> summary.anylist, summary.distfun, summary.funxy,
#> summary.hyperframe, summary.im, Summary.im, Summary.imlist,
#> summary.listof, summary.logiquad, summary.lut, summary.owin,
#> summary.pp3, summary.ppp, summary.pppmatching, summary.ppx,
#> summary.psp, summary.quad, summary.solist, summary.splitppp,
#> summary.splitppx, summary.unitname, superimpose,
#> superimpose.default, superimpose.ppp, superimpose.ppplist,
#> superimpose.psp, superimpose.splitppp, superimposeMarks, symbolmap,
#> symbolmapdomain, symbolmaptype, tail.hyperframe, tail.ppp,
#> tail.ppx, tail.psp, tail.tess, tess, test.crossing.psp,
#> test.selfcrossing.psp, text.ppp, text.psp, textstring, texturemap,
#> textureplot, tile.areas, tilecentroids, tileindex, tilenames,
#> tilenames.tess, tilenames<-, tilenames<-.tess, tiles, tiles.empty,
#> timed, timeTaken, to.grey, to.opaque, to.saturated, to.transparent,
#> transmat, trianglediameters, triangulate.owin, trim.mask,
#> trim.rectangle, tweak.closepairs, tweak.colourmap, union.owin,
#> union.quad, unique.ppp, unique.ppx, uniquemap,
#> uniquemap.data.frame, uniquemap.default, uniquemap.lpp,
#> uniquemap.matrix, uniquemap.ppp, uniquemap.ppx, unit.square,
#> unitname, unitname.box3, unitname.boxx, unitname.default,
#> unitname.im, unitname.owin, unitname.pp3, unitname.ppp,
#> unitname.ppx, unitname.psp, unitname.quad, unitname.tess,
#> unitname<-, unitname<-.box3, unitname<-.boxx, unitname<-.default,
#> unitname<-.im, unitname<-.owin, unitname<-.pp3, unitname<-.ppp,
#> unitname<-.ppx, unitname<-.psp, unitname<-.quad, unitname<-.tess,
#> unmark, unmark.ppp, unmark.ppx, unmark.psp, unmark.splitppp,
#> unmark.tess, unnormdensity, unstack.layered, unstack.ppp,
#> unstack.psp, unstack.solist, unstack.tess, unstackFilter,
#> update.im, update.symbolmap, validate.mask, validate.quad,
#> validradius, vdCorput, venn.tess, verifyclass,
#> versioncurrency.spatstat, versionstring.spatstat, vertices,
#> vertices.owin, veryunique, volume, volume.box3, volume.boxx,
#> volume.owin, w.quad, warn.once, waxlyrical, weighted.median,
#> weighted.quantile, weighted.var, where.max, where.min,
#> whichhalfplane, whist, Window, Window.distfun, Window.funxy,
#> Window.im, Window.layered, Window.nnfun, Window.ppp, Window.psp,
#> Window.quad, Window.quadratcount, Window.tess, Window<-,
#> Window<-.im, Window<-.ppp, Window<-.psp, with.hyperframe, x.quad,
#> xtfrm.im, xy.grid, xypolygon2psp, xypolyselfint, y.quad, yardstick,
#> zapsmall.im, ZeroValue, ZeroValue.im
library(remotes)
Create sfc_POLYGON
object
triangle <- st_sfc(st_polygon(list(cbind(c(1,1,2,1),c(1,2,2,1)))))
Convet sfc_POLYGONS
object to owin
object with spatstat
and spatstat.geom
W_spst <- spatstat::as.owin(triangle)
plot(W_spst)
W_spst.geom <- spatstat.geom::as.owin(triangle)
plot(W_spst.geom)
Next, remove CRAN sf
and install your fork of sf
# Remove CRAN 'sf'
remove.packages("sf")
#> Removing package from '/Library/Frameworks/R.framework/Versions/4.0/Resources/library'
#> (as 'lib' is unspecified)
# Install Rubak for of 'sf'
install_github("rubak/sf")
#> Using github PAT from envvar GITHUB_PAT
#> Downloading GitHub repo rubak/sf@HEAD
#> Registered S3 method overwritten by 'cli':
#> method from
#> print.boxx spatstat.geom
#>
#> checking for file ‘/private/var/folders/51/r35_6_fj7lbd_ctbns2x49ccm70cn8/T/RtmpQHHrs8/remotesb3ca39d7293f/rubak-sf-e71a7d4/DESCRIPTION’ ... ✓ checking for file ‘/private/var/folders/51/r35_6_fj7lbd_ctbns2x49ccm70cn8/T/RtmpQHHrs8/remotesb3ca39d7293f/rubak-sf-e71a7d4/DESCRIPTION’
#> ─ preparing ‘sf’:
#> checking DESCRIPTION meta-information ... ✓ checking DESCRIPTION meta-information
#> ─ cleaning src
#> ─ running ‘cleanup’
#> ─ checking for LF line-endings in source and make files and shell scripts
#> ─ checking for empty or unneeded directories
#> ─ building ‘sf_0.9-8.tar.gz’
#> Warning: invalid uid value replaced by that for user 'nobody'
#> Warning: invalid gid value replaced by that for user 'nobody'
#>
#>
# Load Rubak fork of 'sf'
library(sf)
Re-run example
triangle <- st_sfc(st_polygon(list(cbind(c(1,1,2,1),c(1,2,2,1)))))
W_spst <- spatstat::as.owin(triangle)
plot(W_spst)
W_spst.geom <- spatstat.geom::as.owin(triangle)
plot(W_spst.geom)
Here is my session info:
## Session Info
sessionInfo()
#> R version 4.0.3 (2020-10-10)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Catalina 10.15.7
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] remotes_2.2.0 spatstat.geom_1.65-5 spatstat_1.64-1
#> [4] rpart_4.1-15 nlme_3.1-151 spatstat.data_1.7-0
#> [7] sf_0.9-8
#>
#> loaded via a namespace (and not attached):
#> [1] styler_1.3.2 tidyselect_1.1.0 xfun_0.20
#> [4] purrr_0.3.4 splines_4.0.3 lattice_0.20-41
#> [7] spatstat.utils_2.0-0 vctrs_0.3.6 generics_0.1.0
#> [10] htmltools_0.5.1.1 yaml_2.2.1 mgcv_1.8-33
#> [13] rlang_0.4.10 pkgbuild_1.2.0 e1071_1.7-4
#> [16] pillar_1.4.7 withr_2.4.1 glue_1.4.2
#> [19] DBI_1.1.1 lifecycle_0.2.0 stringr_1.4.0
#> [22] evaluate_0.14 knitr_1.31 callr_3.5.1
#> [25] ps_1.5.0 curl_4.3 class_7.3-18
#> [28] highr_0.8 Rcpp_1.0.6 KernSmooth_2.23-18
#> [31] tensor_1.5 backports_1.2.1 classInt_0.4-3
#> [34] abind_1.4-5 deldir_0.2-9 fs_1.5.0
#> [37] digest_0.6.27 stringi_1.5.3 processx_3.4.5
#> [40] dplyr_1.0.4 spatstat.sparse_1.2-0 rprojroot_2.0.2
#> [43] polyclip_1.10-0 grid_4.0.3 cli_2.3.0
#> [46] tools_4.0.3 magrittr_2.0.1 goftest_1.2-2
#> [49] tibble_3.0.6 crayon_1.4.0 pkgconfig_2.0.3
#> [52] ellipsis_0.3.1 Matrix_1.3-2 prettyunits_1.1.1
#> [55] reprex_1.0.0 assertthat_0.2.1 rmarkdown_2.6
#> [58] R6_2.5.0 units_0.6-7 compiler_4.0.3
Created on 2021-02-06 by the reprex package (v1.0.0)
Thanks @idblr. I'm puzzled. Would you mind running a short version with updated spatstat?
remotes::install_github("rubak/sf")
remotes::install_github("baddstats/spatstat")
library(sf)
print(sf:::as.owin.MULTIPOLYGON)
triangle <- st_sfc(st_polygon(list(cbind(c(1,1,2,1),c(1,2,2,1)))))
spatstat.geom::as.owin(triangle)
library(spatstat)
as.owin(triangle)
Hi @rubak, Sure thing! See below:
# Remove packages
remove.packages("sf")
#> Removing package from '/Library/Frameworks/R.framework/Versions/4.0/Resources/library'
#> (as 'lib' is unspecified)
remove.packages("spatstat")
#> Removing package from '/Library/Frameworks/R.framework/Versions/4.0/Resources/library'
#> (as 'lib' is unspecified)
remove.packages("spatstat.geom")
#> Removing package from '/Library/Frameworks/R.framework/Versions/4.0/Resources/library'
#> (as 'lib' is unspecified)
remotes::install_github("rubak/sf")
#> Using github PAT from envvar GITHUB_PAT
#> Downloading GitHub repo rubak/sf@HEAD
#>
#> checking for file ‘/private/var/folders/51/r35_6_fj7lbd_ctbns2x49ccm70cn8/T/RtmpswVcGb/remotesd768493bc816/rubak-sf-e71a7d4/DESCRIPTION’ ... ✓ checking for file ‘/private/var/folders/51/r35_6_fj7lbd_ctbns2x49ccm70cn8/T/RtmpswVcGb/remotesd768493bc816/rubak-sf-e71a7d4/DESCRIPTION’
#> ─ preparing ‘sf’:
#> checking DESCRIPTION meta-information ... ✓ checking DESCRIPTION meta-information
#> ─ cleaning src
#> ─ running ‘cleanup’
#> ─ checking for LF line-endings in source and make files and shell scripts
#> ─ checking for empty or unneeded directories
#> ─ building ‘sf_0.9-8.tar.gz’
#> Warning: invalid uid value replaced by that for user 'nobody'
#> Warning: invalid gid value replaced by that for user 'nobody'
#>
#>
remotes::install_github("baddstats/spatstat")
#> Using github PAT from envvar GITHUB_PAT
#> Downloading GitHub repo baddstats/spatstat@HEAD
#> spatstat.... (NA -> 16fd2e652...) [GitHub]
#> Downloading GitHub repo spatstat/spatstat.geom@HEAD
#>
#> checking for file ‘/private/var/folders/51/r35_6_fj7lbd_ctbns2x49ccm70cn8/T/RtmpswVcGb/remotesd76866209f9e/spatstat-spatstat.geom-16fd2e6/DESCRIPTION’ ... ✓ checking for file ‘/private/var/folders/51/r35_6_fj7lbd_ctbns2x49ccm70cn8/T/RtmpswVcGb/remotesd76866209f9e/spatstat-spatstat.geom-16fd2e6/DESCRIPTION’
#> ─ preparing ‘spatstat.geom’:
#> ✓ checking DESCRIPTION meta-information
#> ─ cleaning src
#> ─ checking for LF line-endings in source and make files and shell scripts (574ms)
#> ─ checking for empty or unneeded directories
#> ─ building ‘spatstat.geom_1.65-5.tar.gz’
#> Warning: invalid uid value replaced by that for user 'nobody'
#> Warning: invalid gid value replaced by that for user 'nobody'
#>
#>
#> Skipping install of 'spatstat.geom' from a github remote, the SHA1 (16fd2e65) has not changed since last install.
#> Use `force = TRUE` to force installation
#> checking for file ‘/private/var/folders/51/r35_6_fj7lbd_ctbns2x49ccm70cn8/T/RtmpswVcGb/remotesd76837026fdd/baddstats-spatstat-578a1b7/DESCRIPTION’ ... ✓ checking for file ‘/private/var/folders/51/r35_6_fj7lbd_ctbns2x49ccm70cn8/T/RtmpswVcGb/remotesd76837026fdd/baddstats-spatstat-578a1b7/DESCRIPTION’
#> ─ preparing ‘spatstat’:
#> checking DESCRIPTION meta-information ... ✓ checking DESCRIPTION meta-information
#> ─ checking for LF line-endings in source and make files and shell scripts
#> ─ checking for empty or unneeded directories
#> ─ building ‘spatstat_2.0-0.tar.gz’
#> Warning: invalid uid value replaced by that for user 'nobody'
#> Warning: invalid gid value replaced by that for user 'nobody'
#>
#>
library(sf)
#> Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1
print(sf:::as.owin.MULTIPOLYGON)
#> function (W, ..., fatal, check_polygons = TRUE)
#> {
#> if (!requireNamespace("spatstat.geom", quietly = TRUE))
#> stop("package spatstat.geom required, please install it (or the full spatstat package) first")
#> if (check_polygons)
#> W = check_ring_dir(W)
#> bb = st_bbox(W)
#> spatstat.geom::owin(bb[c("xmin", "xmax")], bb[c("ymin", "ymax")],
#> poly = unlist(W, recursive = FALSE))
#> }
#> <bytecode: 0x7ff0bd397e00>
#> <environment: namespace:sf>
triangle <- st_sfc(st_polygon(list(cbind(c(1,1,2,1),c(1,2,2,1)))))
spatstat.geom::as.owin(triangle)
#> Registered S3 method overwritten by 'spatstat.geom':
#> method from
#> print.boxx cli
#> window: polygonal boundary
#> enclosing rectangle: [1, 2] x [1, 2] units
library(spatstat)
#> Loading required package: spatstat.data
#> Loading required package: spatstat.geom
#> spatstat.geom 1.65-5
#> Loading required package: spatstat.core
#> Loading required package: nlme
#> Loading required package: rpart
#> spatstat.core 1.65-6
#> Loading required package: spatstat.linnet
#>
#> spatstat 1.65-5 (nickname: 'Famous Last Words')
#> For an introduction to spatstat, type 'beginner'
as.owin(triangle)
#> window: polygonal boundary
#> enclosing rectangle: [1, 2] x [1, 2] units
sessionInfo()
#> R version 4.0.3 (2020-10-10)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Catalina 10.15.7
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] spatstat_2.0-0 spatstat.linnet_1.65-4 spatstat.core_1.65-6
#> [4] rpart_4.1-15 nlme_3.1-151 spatstat.geom_1.65-5
#> [7] spatstat.data_1.7-0 sf_0.9-8
#>
#> loaded via a namespace (and not attached):
#> [1] styler_1.3.2 tidyselect_1.1.0 xfun_0.20
#> [4] remotes_2.2.0 purrr_0.3.4 splines_4.0.3
#> [7] lattice_0.20-41 vctrs_0.3.6 generics_0.1.0
#> [10] spatstat.utils_1.20-3 htmltools_0.5.1.1 mgcv_1.8-33
#> [13] yaml_2.2.1 rlang_0.4.10 pkgbuild_1.2.0
#> [16] e1071_1.7-4 pillar_1.4.7 glue_1.4.2
#> [19] withr_2.4.1 DBI_1.1.1 lifecycle_0.2.0
#> [22] stringr_1.4.0 evaluate_0.14 knitr_1.31
#> [25] callr_3.5.1 ps_1.5.0 curl_4.3
#> [28] class_7.3-18 highr_0.8 Rcpp_1.0.6
#> [31] KernSmooth_2.23-18 tensor_1.5 backports_1.2.1
#> [34] classInt_0.4-3 abind_1.4-5 deldir_0.2-9
#> [37] fs_1.5.0 digest_0.6.27 stringi_1.5.3
#> [40] processx_3.4.5 dplyr_1.0.4 spatstat.sparse_1.2-1
#> [43] polyclip_1.10-0.001 rprojroot_2.0.2 grid_4.0.3
#> [46] cli_2.3.0 tools_4.0.3 goftest_1.2-2
#> [49] magrittr_2.0.1 tibble_3.0.6 crayon_1.4.0
#> [52] pkgconfig_2.0.3 ellipsis_0.3.1 Matrix_1.3-2
#> [55] prettyunits_1.1.1 reprex_1.0.0 assertthat_0.2.1
#> [58] rmarkdown_2.6 R6_2.5.0 units_0.6-7
#> [61] compiler_4.0.3
Created on 2021-02-06 by the reprex package (v1.0.0)
OK. So in this case everything works as it should. The window is a polygon. This must be the most important thing as this configuration of spatstat
and sf
is what is coming to CRAN.
I'm still puzzled by your earlier example. We could try two tests more.
One without spatstat at all:
remove.packages("spatstat")
library(sf)
print(sf:::as.owin.MULTIPOLYGON)
triangle <- st_sfc(st_polygon(list(cbind(c(1,1,2,1),c(1,2,2,1)))))
spatstat.geom::as.owin(triangle)
And one with old spatstat:
install.packages("spatstat")
library(sf)
print(sf:::as.owin.MULTIPOLYGON)
triangle <- st_sfc(st_polygon(list(cbind(c(1,1,2,1),c(1,2,2,1)))))
spatstat.geom::as.owin(triangle)
The print commands are just so I can see that it is my fork of sf
that is running.
Hi @rubak, I ran this with your fork of sf
(i.e., I did not remove and reinstall CRAN sf
)
One without spatstat at all
remove.packages("spatstat")
#> Removing package from '/Library/Frameworks/R.framework/Versions/4.0/Resources/library'
#> (as 'lib' is unspecified)
library(sf)
#> Linking to GEOS 3.9.0, GDAL 3.2.1, PROJ 7.2.1
print(sf:::as.owin.MULTIPOLYGON)
#> function (W, ..., fatal, check_polygons = TRUE)
#> {
#> if (!requireNamespace("spatstat.geom", quietly = TRUE))
#> stop("package spatstat.geom required, please install it (or the full spatstat package) first")
#> if (check_polygons)
#> W = check_ring_dir(W)
#> bb = st_bbox(W)
#> spatstat.geom::owin(bb[c("xmin", "xmax")], bb[c("ymin", "ymax")],
#> poly = unlist(W, recursive = FALSE))
#> }
#> <bytecode: 0x7ffc5c4e2f90>
#> <environment: namespace:sf>
triangle <- st_sfc(st_polygon(list(cbind(c(1,1,2,1),c(1,2,2,1)))))
spatstat.geom::as.owin(triangle)
#> window: polygonal boundary
#> enclosing rectangle: [1, 2] x [1, 2] units
sessionInfo()
#> R version 4.0.3 (2020-10-10)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Catalina 10.15.7
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] sf_0.9-8
#>
#> loaded via a namespace (and not attached):
#> [1] Rcpp_1.0.6 pillar_1.4.7 compiler_4.0.3
#> [4] highr_0.8 class_7.3-18 tools_4.0.3
#> [7] digest_0.6.27 lattice_0.20-41 evaluate_0.14
#> [10] lifecycle_0.2.0 tibble_3.0.6 pkgconfig_2.0.3
#> [13] rlang_0.4.10 reprex_1.0.0 Matrix_1.3-2
#> [16] DBI_1.1.1 yaml_2.2.1 xfun_0.20
#> [19] e1071_1.7-4 spatstat.data_1.7-0 styler_1.3.2
#> [22] stringr_1.4.0 dplyr_1.0.4 knitr_1.31
#> [25] generics_0.1.0 fs_1.5.0 vctrs_0.3.6
#> [28] spatstat.utils_1.20-3 classInt_0.4-3 grid_4.0.3
#> [31] tidyselect_1.1.0 glue_1.4.2 R6_2.5.0
#> [34] spatstat.geom_1.65-5 rmarkdown_2.6 polyclip_1.10-0.001
#> [37] deldir_0.2-9 tensor_1.5 purrr_0.3.4
#> [40] magrittr_2.0.1 backports_1.2.1 ellipsis_0.3.1
#> [43] htmltools_0.5.1.1 units_0.6-7 abind_1.4-5
#> [46] spatstat.sparse_1.2-1 KernSmooth_2.23-18 stringi_1.5.3
#> [49] crayon_1.4.0
And one with old spatstat
install.packages("spatstat")
#>
#> The downloaded binary packages are in
#> /var/folders/51/r35_6_fj7lbd_ctbns2x49ccm70cn8/T//Rtmps042yI/downloaded_packages
library(sf)
print(sf:::as.owin.MULTIPOLYGON)
#> function (W, ..., fatal, check_polygons = TRUE)
#> {
#> if (!requireNamespace("spatstat.geom", quietly = TRUE))
#> stop("package spatstat.geom required, please install it (or the full spatstat package) first")
#> if (check_polygons)
#> W = check_ring_dir(W)
#> bb = st_bbox(W)
#> spatstat.geom::owin(bb[c("xmin", "xmax")], bb[c("ymin", "ymax")],
#> poly = unlist(W, recursive = FALSE))
#> }
#> <bytecode: 0x7ffc5c4e2f90>
#> <environment: namespace:sf>
triangle <- st_sfc(st_polygon(list(cbind(c(1,1,2,1),c(1,2,2,1)))))
spatstat.geom::as.owin(triangle)
#> window: polygonal boundary
#> enclosing rectangle: [1, 2] x [1, 2] units
sessionInfo()
#> R version 4.0.3 (2020-10-10)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Catalina 10.15.7
#>
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
#>
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] sf_0.9-8
#>
#> loaded via a namespace (and not attached):
#> [1] Rcpp_1.0.6 pillar_1.4.7 compiler_4.0.3
#> [4] highr_0.8 class_7.3-18 tools_4.0.3
#> [7] digest_0.6.27 lattice_0.20-41 evaluate_0.14
#> [10] lifecycle_0.2.0 tibble_3.0.6 pkgconfig_2.0.3
#> [13] rlang_0.4.10 reprex_1.0.0 Matrix_1.3-2
#> [16] DBI_1.1.1 yaml_2.2.1 xfun_0.20
#> [19] e1071_1.7-4 spatstat.data_1.7-0 styler_1.3.2
#> [22] stringr_1.4.0 dplyr_1.0.4 knitr_1.31
#> [25] generics_0.1.0 fs_1.5.0 vctrs_0.3.6
#> [28] spatstat.utils_1.20-3 classInt_0.4-3 grid_4.0.3
#> [31] tidyselect_1.1.0 glue_1.4.2 R6_2.5.0
#> [34] spatstat.geom_1.65-5 rmarkdown_2.6 polyclip_1.10-0.001
#> [37] deldir_0.2-9 tensor_1.5 purrr_0.3.4
#> [40] magrittr_2.0.1 backports_1.2.1 ellipsis_0.3.1
#> [43] htmltools_0.5.1.1 units_0.6-7 abind_1.4-5
#> [46] spatstat.sparse_1.2-1 KernSmooth_2.23-18 stringi_1.5.3
#> [49] crayon_1.4.0
Created on 2021-02-06 by the reprex package (v1.0.0)
OK. Everything looks perfect. As long as you have the updated sf
and call spatstat.geom::as.owin()
then you get the right result no matter which version of spatstat you have installed. With updated sf
the problem only occurs if you have the old version of spatstat and run spatstat::as.owin()
. This is because updated sf
doesn't register an S3 method for spatstat::as.owin()
, so it falls back to spatstat::as.owin.default()
which finds the bounding box of the sf
object and returns that. I don't think we need to do more about this and I will close the issue. Thanks for all the testing @idblr.
Happy to help, @rubak! Thanks for all the hard work on the spatstat updates
My goal is to create an
owin
object from asfc_POLYGON
object. I recently migrated to 'spatstat.geom' v1.65-5 from 'spatstat' v1.64-1 and I noticed theas.owin()
function produces different output between the two packages.Can you recommend a solution? Thank you!