31  groupedHyperframe

The examples in Chapter 31 require that the search path contains the following namespaces,

library(groupedHyperframe)
library(survival)

31.1 Use groupedHyperframe as grouped_ppp() input

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? Listing 31.1 creates a grouped hyper data frame lung_g2 which retains the \(x\)- and \(y\)-coords,

Listing 31.1: Example: lung_g2 retaining \(x\)- and \(y\)-coords
Code
lung_g2 = wrobel_lung |>
  within.data.frame(expr = {
    dapi = NULL
  }) |>
  as.groupedHyperframe(group = ~ patient_id/image_id)
lung_g2
# Grouped Hyperframe: ~patient_id/image_id
# 
# 15 image_id nested in
# 3 patient_id
# 
# Preview of first 10 (or less) rows:
# 
#            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
# 5  (numeric) (numeric) (numeric)  (factor) [45366,16647].im3 #01 0-889-121      F 3488+  85
# 6  (numeric) (numeric) (numeric)  (factor) [56576,16907].im3 #02 1-037-393      M  1605  66
# 7  (numeric) (numeric) (numeric)  (factor) [56583,15235].im3 #02 1-037-393      M  1605  66
# 8  (numeric) (numeric) (numeric)  (factor) [57130,16082].im3 #02 1-037-393      M  1605  66
# 9  (numeric) (numeric) (numeric)  (factor) [57396,17896].im3 #02 1-037-393      M  1605  66
# 10 (numeric) (numeric) (numeric)  (factor) [57403,16934].im3 #02 1-037-393      M  1605  66

Can we convert the grouped hyper data frame lung_g2 into something similar to the grouped hyper data frame s (Section 3.1)? Unfortunately, such functionality is not planned for package groupedHyperframe (v0.3.0.20251020).