44  grouped_ppp()

The examples in Chapter 44 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"    "splines"          
# [64] "stats"             "survival"          "systemfonts"       "tensor"            "textshaping"       "tibble"            "tidyselect"        "tools"             "utils"            
# [73] "vctrs"             "viridisLite"       "xfun"              "yaml"

Function grouped_ppp() creates a grouped hyper data frame (Chapter 24) with one-and-only-one (Section 25.13) ppp-hypercolumn, from a data frame.

In Listing 2.1, the argument formula takes form of <marks> ~ <variable.of.interest> | <group>, specifically,

Listing 44.1 shows the use of the dot symbol . to denote the remaining variables except for those mentioned in the marks and the nested grouping structure.

Listing 44.1: Advanced: function grouped_ppp(formula = <marks> ~ . | <group>)
wrobel_lung |>
   grouped_ppp(formula = hladr + phenotype ~ . | patient_id/image_id)
# Grouped Hyper Data Frame: ~patient_id/image_id
# 
# 15 image_id nested in
# 3 patient_id
# 
#       patient_id          image_id gender    OS age  ppp.
# 1  #01 0-889-121 [40864,18015].im3      F 3488+  85 (ppp)
# 2  #01 0-889-121 [42689,19214].im3      F 3488+  85 (ppp)
# 3  #01 0-889-121 [42806,16718].im3      F 3488+  85 (ppp)
# 4  #01 0-889-121 [44311,17766].im3      F 3488+  85 (ppp)
# ✂️ --- output truncated --- ✂️