55  hyperframe

Chapter 55 outlines the S3 methods currently not planned for the class 'hyperframe' (Chapter 25).

55.1 as.environment()

The author does not implement an S3 method as.environment to the class 'hyperframe', as it would be a simple pipeline of functions spatstat.geom::as.list.hyperframe() and base::list2env().

Listing 55.1: Workaround: as.environment of hyperframe
ev = spatstat.data::demohyper |> 
  spatstat.geom::as.list.hyperframe() |>
  list2env()
ev |> 
  as.list.environment() |>
  lapply(FUN = class)
# $Group
# [1] "factor"
# 
# $Image
# [1] "imlist"  "solist"  "anylist" "listof"  "list"   
# 
# $Points
# [1] "ppplist" "solist"  "anylist" "listof"  "list"

55.2 merge()

The author does not implement an S4 method merge to the S3 classes 'hyperframe' and/or 'groupedHyperframe', for the obstacles explained below.

  1. There is not an S3 method merge.hyperframe in package spatstat.geom (v3.7.0.6);

  2. Should the author elect to implement an S4 setMethod(f = merge, ...) for the class 'hyperframe', at least two method signatures must be defined,

    • c(x = 'hyperframe', y = 'data.frame')
    • c(x = 'hyperframe', y = 'hyperframe'), for which the author needs to define a match mechanism for hypercolumns.
  3. Should the author elect to implement an S4 setMethod(f = merge, ...) for the class 'groupedHyperframe', at least three method signatures must be defined,

    • c(x = 'groupedHyperframe', y = 'data.frame')
    • c(x = 'groupedHyperframe', y = 'hyperframe'), as explained above;
    • c(x = 'groupedHyperframe', y = 'groupedHyperframe'), for which the author needs to consider the (potentially different) grouping structures of x and y inputs.

The author suggests using the pipeline of functions base::merge.data.frame() and as.groupedHyperframe() as a workaround.

55.3 Group-Generic

55.3.1 Math

The author does not implement the Math group-generic to the S3 classes 'hyperframe' and/or 'groupedHyperframe'.

The author suggests the following workaround,

55.3.2 Summary

The author does not implement the Summary group-generic to the S3 classes 'hyperframe' and/or 'groupedHyperframe'.

The author suggests the following workaround,

  • apply the S3 method Summary.ppplist() (Section 36.5.2) to any or all of the ppp-hypercolumns, as desired;
  • apply the S3 method Summary.fvlist() (Section 20.7.2) to any or all of the fv-hypercolumns, as desired;
  • replace the original hypercolumn using the S3 method spatstat.geom::`$<-.hyperframe`.