| Title: | Grouped Hyper Data Frame |
|---|---|
| Description: | To aggregate a hyper data frame, defined in the package 'spatstat.geom', according to a grouping structure. To facilitate downstream analysis based on a "grouped" hyper data frame. |
| Authors: | Tingting Zhan [aut, cre] (ORCID: <https://orcid.org/0000-0001-9971-4844>) |
| Maintainer: | Tingting Zhan <[email protected]> |
| License: | GPL-2 |
| Version: | 0.4.1 |
| Built: | 2026-06-02 05:36:38 UTC |
| Source: | https://github.com/tingtingzhan/groupedhyperframe |
To aggregate a hyper data frame, defined in the package 'spatstat.geom', according to a grouping structure. To facilitate downstream analysis based on a "grouped" hyper data frame.
Maintainer: Tingting Zhan [email protected] (ORCID)
Authors:
Tingting Zhan [email protected] (ORCID)
Useful links:
To aggregate a hyperframe.
## S3 method for class 'hyperframe' aggregate(x, by, ...)## S3 method for class 'hyperframe' aggregate(x, by, ...)
x |
|
by |
two-sided formula,
whose right-hand-side contains only the regular-column names of the input |
... |
additional parameters of the function aggregate.data.frame,
except for |
The S3 method aggregate.hyperframe() returns a hyperframe.
spatstat.data::demohyper |> aggregate(by = . ~ Group, FUN = unique) spatstat.data::flu |> aggregate(by = . - frameid ~ virustype:stain, FUN = unique) spatstat.data::osteo |> aggregate(by = . - brick ~ shortid, FUN = unique)spatstat.data::demohyper |> aggregate(by = . ~ Group, FUN = unique) spatstat.data::flu |> aggregate(by = . - frameid ~ virustype:stain, FUN = unique) spatstat.data::osteo |> aggregate(by = . - brick ~ shortid, FUN = unique)
An alternative aggregation function with a formula-interface, to avoid the cbind-operation in the function aggregate.formula.
aggregate2(data, by, ...)aggregate2(data, by, ...)
data |
|
by |
a two-sided formula |
... |
additional parameters of the function aggregate.data.frame,
except for |
The cbind-operation in the function aggregate.formula messes up with column(s) that are
The function aggregate.data.frame only accepts
a list of factors for the parameter by.
Therefore, the function aggregate2() is created to take care of
the factor and Surv columns of the input,
with a formula-interface.
The function aggregate2() returns a data.frame.
The function aggregate.data.frame is the workhorse of the function aggregate.formula.
The function as.hyperframe.data.frame is designed to handle the list-columns returned by the function aggregate.
vectorlist
Convert R Object to vectorlist
as.vectorlist(x, ...)as.vectorlist(x, ...)
x |
a list |
... |
additional parameters of the function |
The function as.vectorlist() returns an R object of S3 class 'vectorlist'.
list(rnorm(6L), rnorm(6L)) |> as.vectorlist()list(rnorm(6L), rnorm(6L)) |> as.vectorlist()
Augment all numeric vector hypercolumns in a hyperframe for gam.
aug4gam(x, ...) ## S3 method for class 'data.frame' aug4gam(x, ...) ## S3 method for class 'hyperframe' aug4gam(x, ...) ## S3 method for class 'vectorlist' aug4gam(x, ...)aug4gam(x, ...) ## S3 method for class 'data.frame' aug4gam(x, ...) ## S3 method for class 'hyperframe' aug4gam(x, ...) ## S3 method for class 'vectorlist' aug4gam(x, ...)
x |
see Usage |
... |
additional parameters, currently of no use |
The S3 generic function aug4gam() returns a data.frame.
Tingting Zhan, Erjia Cui
To determine if an R object is a list of vectors with the same storage.mode, length and attributes.
is.vectorlist( x, mode = c("logical", "integer", "numeric", "double", "character") )is.vectorlist( x, mode = c("logical", "integer", "numeric", "double", "character") )
x |
a listof |
mode |
character scalar other than |
The function is.vectorlist() returns a logical scalar.
spatstat.data::Kovesi$values |> is.vectorlist(mode = 'character') |> stopifnot() spatstat.data::Kovesi$values |> is.vectorlist(mode = 'numeric')spatstat.data::Kovesi$values |> is.vectorlist(mode = 'character') |> stopifnot() spatstat.data::Kovesi$values |> is.vectorlist(mode = 'numeric')
To create a hyper data frame with one-and-only-one ppp-hyper column.
pppBy( marks, coords = ~x + y, by, data, window = owin(xrange = range(.x), yrange = range(.y)), ... )pppBy( marks, coords = ~x + y, by, data, window = owin(xrange = range(.x), yrange = range(.y)), ... )
marks |
one-sided formula, e.g.,
|
coords |
one-sided formula, variable names
of the |
by |
two-sided formula |
data |
|
window |
observation window owin,
default value is the |
... |
additional parameters of the function ppp |
The function pppBy() returns a hyper data frame
with one-and-only-one
ppp-hyper column.