flatten.dims: Flatten the X and Y dimensions down to a space dimension.

View source: R/support_functions.R

flatten.dimsR Documentation

Flatten the X and Y dimensions down to a space dimension.

Description

Flatten the X and Y dimensions down to a space dimension.

Usage

flatten.dims(dat, reduce.dims, names.subset)

Arguments

dat

The data to operate on.

reduce.dims

The names or indices of the dimensions to reduce to 1 dimension.

names.subset

Optionally, a subset of dimension names to copy.

Details

This function takes input data, a vector of dimensions to reduce to 1 dimension, and optionally a subset of dimnames to copy. It returns the data with the specified dimensions shrunk down to 1 dimension.

Value

The data with the specified dimensions reduced to 1 dimension.

Note

The dimensions to reduce must be adjoining dimensions.

Examples

## Take example data and flatten the last two dims down to one.
dat <- structure(1:8, .Dim=c(2, 2, 2))
dat.flat <- flatten.dims(dat, 2:3)


ECA-D/ecad_indices_grid documentation built on Nov. 23, 2022, 6:04 a.m.