Package 'groupedHyperframe'

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

Help Index


groupedHyperframe: 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.

Author(s)

Maintainer: Tingting Zhan [email protected] (ORCID)

Authors:

See Also

Useful links:


Aggregate Hyper Data Frame

Description

To aggregate a hyperframe.

Usage

## S3 method for class 'hyperframe'
aggregate(x, by, ...)

Arguments

x

hyperframe

by

two-sided formula, whose right-hand-side contains only the regular-column names of the input x

...

additional parameters of the function aggregate.data.frame, except for simplify

Value

The S3 method aggregate.hyperframe() returns a hyperframe.

Examples

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)

Aggregate, an Alternative formula-Interface

Description

An alternative aggregation function with a formula-interface, to avoid the cbind-operation in the function aggregate.formula.

Usage

aggregate2(data, by, ...)

Arguments

data

a data.frame

by

a two-sided formula

...

additional parameters of the function aggregate.data.frame, except for simplify

Details

The cbind-operation in the function aggregate.formula messes up with column(s) that are

factor

and treat them as integer

Surv

and treat them as matrix

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.

Value

The function aggregate2() returns a data.frame.

Note

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.


Convert R Object to vectorlist

Description

Convert R Object to vectorlist

Usage

as.vectorlist(x, ...)

Arguments

x

a list

...

additional parameters of the function is.vectorlist()

Value

The function as.vectorlist() returns an R object of S3 class 'vectorlist'.

Examples

list(rnorm(6L), rnorm(6L)) |>
 as.vectorlist()

Augment Hypercolumn(s) for gam

Description

Augment all numeric vector hypercolumns in a hyperframe for gam.

Usage

aug4gam(x, ...)

## S3 method for class 'data.frame'
aug4gam(x, ...)

## S3 method for class 'hyperframe'
aug4gam(x, ...)

## S3 method for class 'vectorlist'
aug4gam(x, ...)

Arguments

x

see Usage

...

additional parameters, currently of no use

Value

The S3 generic function aug4gam() returns a data.frame.

Author(s)

Tingting Zhan, Erjia Cui


Vector-List

Description

To determine if an R object is a list of vectors with the same storage.mode, length and attributes.

Usage

is.vectorlist(
  x,
  mode = c("logical", "integer", "numeric", "double", "character")
)

Arguments

x

a listof

mode

character scalar other than 'any', 'complex' and 'raw', see the function is.vector

Value

The function is.vectorlist() returns a logical scalar.

Examples

spatstat.data::Kovesi$values |>
 is.vectorlist(mode = 'character') |>
 stopifnot()
spatstat.data::Kovesi$values |>
 is.vectorlist(mode = 'numeric')

Hyper Data Frame with One-and-Only-One ppp-Hyper Column

Description

To create a hyper data frame with one-and-only-one ppp-hyper column.

Usage

pppBy(
  marks,
  coords = ~x + y,
  by,
  data,
  window = owin(xrange = range(.x), yrange = range(.y)),
  ...
)

Arguments

marks

one-sided formula, e.g., ~ m1+m2, where mim_i's are one or more marks

coords

one-sided formula, variable names of the xx- and yy-coordinates in data. Default value is ~x+y.

by

two-sided formula

data

data.frame

window

observation window owin, default value is the xx- and yy-span of coords in data.

...

additional parameters of the function ppp

Value

The function pppBy() returns a hyper data frame with one-and-only-one ppp-hyper column.