getStackElement: Set or get the i-th data frame of a data.frame stack

View source: R/gmDataFrameStack.R

getStackElementR Documentation

Set or get the i-th data frame of a data.frame stack

Description

Set or get one element of the DataFrameStack()

Usage

getStackElement(x, i, ...)

## Default S3 method:
getStackElement(x, i, ...)

## S3 method for class 'list'
getStackElement(x, i, ...)

## S3 method for class 'DataFrameStack'
getStackElement(x, i, MARGIN = stackDim(x), ...)

## Default S3 method:
setStackElement(x, i, value, ...)

## S3 method for class 'data.frame'
setStackElement(x, i, value, ...)

## S3 method for class 'list'
setStackElement(x, i, value, ...)

## S3 method for class 'DataFrameStack'
setStackElement(x, i, value, MARGIN = stackDim(x), ...)

Arguments

x

container data, typically a DataFrameStack(), but it can also be certain sp::Spatial() object derivates of it

i

index (or name) of the element of the stack to extract or replace

...

extra arguments for generic functionality

MARGIN

which dimension is the stacking dimension? you seldom want to touch this!!

value

for the setting operation, the new data.frame to replace the selected one; note that the compatibility of the dimensions of value is only checked for setStackElement.DataFrameStack and its Spatial derivates; for other methods setStackElement can break the consistency of the stack!

Value

For the getters, the result is the data.frame of the stack asked for. For the setters the result is the original DataFrameStack with the corresponding element replaced. Spatial methods return the corresponding spatial object, ie. the spatial information of the stack is transferred to the extracted element.

Methods (by class)

  • default: Set or get one element of the DataFrameStack()

  • list: Set or get one element of the DataFrameStack()

  • DataFrameStack: Set or get one element of the DataFrameStack()

  • default: Set or get one element of the DataFrameStack()

  • data.frame: Set one element of the DataFrameStack() in data.frame form

  • list: Set get one element of a DataFrameStack() in list form

  • DataFrameStack: Set one element of the DataFrameStack()

Examples

ar = array(1:30, dim = c(5,2,3), dimnames=list(obs=1:5, vars=c("A","B"), rep=1:3))
dfs = DataFrameStack(ar, stackDim="rep")
dfs
stackDim(dfs)
getStackElement(dfs, 1)

gmGeostats documentation built on April 18, 2023, 5:08 p.m.