drop-methods: drop method for FLCore array-based classes

drop,FLArray-methodR Documentation

drop method for FLCore array-based classes

Description

Delete the dimensions of an array which have only one level.

Usage

## S4 method for signature 'FLArray'
drop(x)

Details

This method calls R's base::drop on the ⁠@.Data⁠ slot of an FLArray. Dimensions of length one are thus dropped, as is the class attribute and the units slot, and an array of equal or less dimensions, a matrix or a vector is returned.

On an FLQuant object with

Author(s)

The FLR Team

See Also

base::drop

Examples

x <- FLQuant(1:3, dim=c(3,3))
drop(x)
is(drop(x))
dim(drop(x))

# Result of drop can be used for matrix algebra
# for example to calculate aging error

data(ple4)
aging.error <- diag(0.8, 10)
diag(aging.error[-1,]) <- c(rep(0.1, 8), 0.2)
diag(aging.error[, -1]) <- c(0.2, rep(0.1, 8))
t(aging.error) %*% drop(catch.n(ple4))

flr/FLCore documentation built on May 4, 2024, midnight