56  groupedHyperframe

The examples in Chapter 56 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"

Chapter 56 outlines the S3 methods currently not planned for the class 'groupedHyperframe' (Chapter 24).

56.1 Use groupedHyperframe as grouped_ppp() input

Listing 56.1 creates a grouped hyper data frame lung_g2 which retains the \(x\)- and \(y\)-coords,

Listing 56.1: Example: lung_g2 retaining \(x\)- and \(y\)-coords
lung_g2 = wrobel_lung |>
  within.data.frame(expr = {
    dapi = NULL
  }) |>
  as.groupedHyperframe(group = ~ patient_id/image_id)
lung_g2
# Grouped Hyper Data Frame: ~patient_id/image_id
# 
# 15 image_id nested in
# 3 patient_id
# 
#            x         y     hladr phenotype          image_id    patient_id gender    OS age
# 1  (numeric) (numeric) (numeric)  (factor) [40864,18015].im3 #01 0-889-121      F 3488+  85
# 2  (numeric) (numeric) (numeric)  (factor) [42689,19214].im3 #01 0-889-121      F 3488+  85
# 3  (numeric) (numeric) (numeric)  (factor) [42806,16718].im3 #01 0-889-121      F 3488+  85
# 4  (numeric) (numeric) (numeric)  (factor) [44311,17766].im3 #01 0-889-121      F 3488+  85
# ✂️ --- output truncated --- ✂️

A curious reader may wonder, is it possible to create a grouped hyper data frame with one-and-only-one ppp-hypercolumn, from a grouped hyper data frame? In other words, can we convert the grouped hyper data frame lung_g2 into something similar to the grouped hyper data frame s (Section 2.1)? Unfortunately, the author does not implement such functionality for package groupedHyperframe (v0.3.4).