40  tess

Function spatstat.geom::tess() creates a tessellation, i.e., an R object of S3 class 'tess'.

The S3 generic function spatstat.geom::as.tess() converts R objects of various classes into a tessellation. Listing 40.1 summarizes the S3 methods for the generic function as.tess() in the spatstat.* family of packages,

Listing 40.1: S3 methods spatstat.*::as.tess.*
Code
suppressPackageStartupMessages(library(spatstat))
.S3methods(generic.function = 'as.tess', all.names = TRUE) |> 
  attr(which = 'info', exact = TRUE) |>
  subset.data.frame(subset = grepl(pattern = '^spatstat\\.', x = from))
#                      visible             from generic  isS4
# as.tess.im              TRUE    spatstat.geom as.tess FALSE
# as.tess.list            TRUE    spatstat.geom as.tess FALSE
# as.tess.owin            TRUE    spatstat.geom as.tess FALSE
# as.tess.quadratcount    TRUE    spatstat.geom as.tess FALSE
# as.tess.quadrattest     TRUE spatstat.explore as.tess FALSE
# as.tess.rppm            TRUE   spatstat.model as.tess FALSE
# as.tess.tess            TRUE    spatstat.geom as.tess FALSE
# as.tess.tessfun         TRUE    spatstat.geom as.tess FALSE

Listing 40.2 summarizes the S3 methods for the class 'tess' in the spatstat.* family of packages,

Listing 40.2: S3 methods spatstat.*::*.tess
Code
suppressPackageStartupMessages(library(spatstat))
.S3methods(class = 'tess', all.names = TRUE) |> 
  attr(which = 'info', exact = TRUE) |>
  subset.data.frame(subset = grepl(pattern = '^spatstat\\.', x = from))
#                    visible          from       generic  isS4
# [.tess                TRUE spatstat.geom             [ FALSE
# [<-.tess              TRUE spatstat.geom           [<- FALSE
# affine.tess           TRUE spatstat.geom        affine FALSE
# as.data.frame.tess    TRUE spatstat.geom as.data.frame FALSE
# as.function.tess      TRUE spatstat.geom   as.function FALSE
# as.im.tess            TRUE spatstat.geom         as.im FALSE
# as.owin.tess          TRUE spatstat.geom       as.owin FALSE
# as.tess.tess          TRUE spatstat.geom       as.tess FALSE
# connected.tess        TRUE spatstat.geom     connected FALSE
# domain.tess           TRUE spatstat.geom        domain FALSE
# flipxy.tess           TRUE spatstat.geom        flipxy FALSE
# head.tess             TRUE spatstat.geom          head FALSE
# identify.tess         TRUE spatstat.geom      identify FALSE
# marks.tess            TRUE spatstat.geom         marks FALSE
# marks<-.tess          TRUE spatstat.geom       marks<- FALSE
# nobjects.tess         TRUE spatstat.geom      nobjects FALSE
# plot.tess             TRUE spatstat.geom          plot FALSE
# print.tess            TRUE spatstat.geom         print FALSE
# reflect.tess          TRUE spatstat.geom       reflect FALSE
# rotate.tess           TRUE spatstat.geom        rotate FALSE
# scalardilate.tess     TRUE spatstat.geom  scalardilate FALSE
# shift.tess            TRUE spatstat.geom         shift FALSE
# tail.tess             TRUE spatstat.geom          tail FALSE
# tilenames.tess        TRUE spatstat.geom     tilenames FALSE
# tilenames<-.tess      TRUE spatstat.geom   tilenames<- FALSE
# unitname.tess         TRUE spatstat.geom      unitname FALSE
# unitname<-.tess       TRUE spatstat.geom    unitname<- FALSE
# unmark.tess           TRUE spatstat.geom        unmark FALSE
# unstack.tess          TRUE spatstat.geom       unstack FALSE
# Window.tess           TRUE spatstat.geom        Window FALSE

The examples in Chapter 40 require

library(groupedHyperframe)
search path & loadedNamespaces on author’s computer
search()
#  [1] ".GlobalEnv"                "package:groupedHyperframe" "package:stats"             "package:graphics"          "package:grDevices"         "package:utils"             "package:datasets"         
#  [8] "package:methods"           "Autoloads"                 "package:base"
loadedNamespaces() |> sort.int()
#  [1] "abind"             "base"              "cli"               "cluster"           "codetools"         "compiler"          "datasets"          "deldir"            "digest"           
# [10] "doParallel"        "dplyr"             "evaluate"          "farver"            "fastmap"           "fastmatrix"        "foreach"           "generics"          "geomtextpath"     
# [19] "GET"               "ggplot2"           "glue"              "goftest"           "graphics"          "grDevices"         "grid"              "gridExtra"         "groupedHyperframe"
# [28] "gtable"            "htmltools"         "htmlwidgets"       "iterators"         "jsonlite"          "knitr"             "lattice"           "lifecycle"         "magrittr"         
# [37] "Matrix"            "matrixStats"       "methods"           "nlme"              "otel"              "parallel"          "patchwork"         "pillar"            "pkgconfig"        
# [46] "polyclip"          "pracma"            "R6"                "RColorBrewer"      "rlang"             "rmarkdown"         "rstudioapi"        "S7"                "scales"           
# [55] "SpatialPack"       "spatstat.data"     "spatstat.explore"  "spatstat.geom"     "spatstat.random"   "spatstat.sparse"   "spatstat.univar"   "spatstat.utils"    "stats"            
# [64] "systemfonts"       "tensor"            "textshaping"       "tibble"            "tidyselect"        "tools"             "utils"             "vctrs"             "viridisLite"      
# [73] "xfun"              "yaml"

Table 40.1 summarizes the S3 methods for the class 'tess' in package groupedHyperframe (v0.3.2.20251225),

Table 40.1: S3 methods groupedHyperframe::*.tess (v0.3.2.20251225)
visible generic isS4
append_marks<-.tess TRUE groupedHyperframe::`append_marks<-` FALSE
Math.tess TRUE methods::Math FALSE

40.1 Math Group-Generic of Numeric Mark(s)

The S3 method Math.tess() transforms one or more numeric marks of a tessellation, and returns a tessellation with the transformed marks (Table 36.3).

Listing 40.3 applies the log-transformation on the numeric marks of the tessellation meningitis$kreise (Section 10.16), and plots the original and log-transformed tessellations side-by-side for comparison (Figure 40.1).

Listing 40.3: Example: log-transformation on tessellation marks
par(mar = c(0,0,0,0))
spatstat.geom::solist(
  kreise_orig = spatstat.data::meningitis$kreise,
  kreise_log = spatstat.data::meningitis$kreise |> log()
) |>
  spatstat.geom::plot.solist(do.col = TRUE, main = 'meningitis$kreise')
Figure 40.1: meningitis$kreise, original versus log-transformed

Listing 40.4 showcases the exception handling of the log-transformation on the tessellation austates (Section 10.3) without any mark.

Listing 40.4: Exception: log-transformation on tessellation, no mark
spatstat.data::austates |>
  log() |>
  identical(y = spatstat.data::austates) |>
  stopifnot()

40.2 🚧 Append to (Existing) Marks

The S3 method `append_marks<-.tess` (Section 36.9, Table 36.9) 🚧