53  hyperframe

Chapter 53 outlines the S3 methods currently not planned for the class 'hyperframe' (Chapter 26).

53.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 53.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"

53.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.6.1.16);

  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.

53.3 Math Group-Generic

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

The author suggests the following workaround,

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