Extract.hyperframe

0th

Percentile

Extract or Replace Subset of Hyperframe

Extract or replace a subset of a hyperframe.

Keywords
manip, spatial
Usage
## S3 method for class 'hyperframe':
[(x, i, j, drop, strip=drop, \dots)
  ## S3 method for class 'hyperframe':
[(x, i, j) <- value
  ## S3 method for class 'hyperframe':
$(x, name)
  ## S3 method for class 'hyperframe':
$(x, name) <- value
Arguments
x
A hyperframe (object of class "hyperframe").
i,j
Row and column indices.
drop,strip
Logical values indicating what to do when the hyperframe has only one row or column. See Details.
...
Ignored.
name
Name of a column of the hyperframe.
value
Replacement value for the subset. A hyperframe or (if the subset is a single column) a list or an atomic vector.
Details

These functions extract a designated subset of a hyperframe, or replace the designated subset with another hyperframe.

The function [.hyperframe is a method for the subset operator [ for the class "hyperframe". It extracts the subset of x specified by the row index i and column index j.

The argument drop determines whether the array structure will be discarded if possible. The argument strip determines whether the list structure in a row or column or cell will be discarded if possible. If drop=FALSE (the default), the return value is always a hyperframe or data frame. If drop=TRUE, and if the selected subset has only one row, or only one column, or both, then

  • ifstrip=FALSE, the result is a list, with one entry for each array cell that was selected.
if strip=TRUE,
  • if the subset has one row containing several columns, the result is a list or (if possible) an atomic vector;
  • if the subset has one column containing several rows, the result is a list or (if possible) an atomic vector;
  • if the subset has exactly one row and exactly one column, the result is the object (or atomic value) contained in this row and column.

Value

  • A hyperframe (of class "hyperframe").

code

$<-

See Also

hyperframe

Aliases
  • [.hyperframe
  • [<-.hyperframe
  • $.hyperframe
  • $<-.hyperframe
Examples
h <- hyperframe(X=list(square(1), square(2)), Y=list(sin, cos))
  h
  h[1, ]
  h[1, ,drop=TRUE]
  h[ , 1]
  h[ , 1, drop=TRUE]
  h[1,1]
  h[1,1,drop=TRUE]
  h[1,1,drop=TRUE,strip=FALSE]
  h[1,1] <- list(square(3))
  # extract column
  h$X
  # replace existing column
  h$Y <- list(cells, cells)
  # add new column
  h$Z <- list(cells, cells)
Documentation reproduced from package spatstat, version 1.37-0, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.