30  hyperframe

30.1 as.environment()

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

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"

30.2 merge()

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

First, there is not an S3 method dispatch merge.hyperframe in package spatstat.geom (v3.6.0.3);

Second, should the authors decide to implement setMethod(f = merge, ...) for the class 'hyperframe', at least two (2) S4 method dispatches need to be written for

  • signature = c(x = 'hyperframe', y = 'data.frame')
  • signature = c(x = 'hyperframe', y = 'hyperframe'), for which the authors need to define a match mechanism for hypercolumns.

Lastly, should the authors decide to implement setMethod(f = merge, ...) for the class 'groupedHyperframe', at least three (3) S4 method dispatches need to be written for

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

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