library(groupedHyperframe)
12 data.frame
The examples in Chapter 12 require that the
search
path contains the followingnamespace
s,
Function base::data.frame()
creates a data frame, i.e., an R object of S3
class 'data.frame'
. In addition to the existing S3
method dispatches spatstat.geom::*.data.frame
(v3.6.0.3, Listing 12.1) and spatstat.univar::*.data.frame
(v3.1.4.1, Listing 12.2),
S3
method dispatches spatstat.geom::*.data.frame
Code
suppressPackageStartupMessages(library(spatstat.geom))
methods(class = 'data.frame', all.names = TRUE) |>
attr(which = 'info', exact = TRUE) |>
subset.data.frame(subset = from == 'spatstat.geom')
# visible from generic isS4
# as.hyperframe.data.frame TRUE spatstat.geom as.hyperframe FALSE
# as.im.data.frame TRUE spatstat.geom as.im FALSE
# as.owin.data.frame TRUE spatstat.geom as.owin FALSE
# as.ppp.data.frame TRUE spatstat.geom as.ppp FALSE
# as.psp.data.frame TRUE spatstat.geom as.psp FALSE
# multiplicity.data.frame TRUE spatstat.geom multiplicity FALSE
S3
method dispatches spatstat.univar::*.data.frame
Code
suppressPackageStartupMessages(library(spatstat.univar))
methods(class = 'data.frame', all.names = TRUE) |>
attr(which = 'info', exact = TRUE) |>
subset.data.frame(subset = from == 'spatstat.univar')
# visible from generic isS4
# uniquemap.data.frame TRUE spatstat.univar uniquemap FALSE
Package groupedHyperframe
implements the following S3
method dispatches to the class 'data.frame'
(Listing 12.3, Table 12.1),
S3
method dispatches groupedHyperframe::*.data.frame
Code
methods2kable(class = 'data.frame', package = 'groupedHyperframe', all.names = TRUE)
S3
method dispatches groupedHyperframe::*.data.frame
(v0.3.0.20251020)
visible | from | generic | isS4 | |
---|---|---|---|---|
as.groupedHyperframe.data.frame |
TRUE | groupedHyperframe | groupedHyperframe::as.groupedHyperframe |
FALSE |
12.1 Create groupedHyperframe
The S3
generic function as.groupedHyperframe()
converts objects of various classes into a groupedHyperframe
(Chapter 16).
The S3
method dispatch as.groupedHyperframe.data.frame()
converts a data.frame
with substantial amount of duplicated information into a groupedHyperframe
. The example in Chapter 2, Listing 2.1, Listing 2.2,
- inspects the input data frame
lung0
by the user-specified (nested)group
ing structure, e.g.,image_id
nested inpatient_id
; - identifies the input
data.frame
column(s) with non-identical elements within the lowest group, e.g., thenumeric
columnlung0$hladr
and thefactor
columnlung0$phenotype
; - converts these column(s) into the hypercolumn(s) of the output
groupedHyperframe
, e.g., thenumeric
-hypercolumnlung_g$hladr
and thefactor
-hypercolumnlung_g$phenotype
. Each row of the outputgroupedHyperframe
represents the lowest group of the nested grouping structure.