Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

newbounds

Redefine bounds of a named matrix


Description

The function restructures a matrix and extends its current limits to a range defined by a names attribute

Usage

newbounds(x, cols = NULL, rows = NULL)

Arguments

x

The matrix to be restructured.

cols

Column names guiding the restructuring.

rows

Row names guiding the restructuring.

Details

This is essentially a subsetting function that allows you to subset even when the rownames or colnames vector extends beyond the bounds of a matrix and traditional subsetting methods result in the notorious 'out of bounds' error.

Value

A matrix with extended bounds.

Examples

a<-matrix(1:9, ncol=3)
rownames(a) <- c("a", "c", "d")
newbounds(a, rows=letters[1:5])

chronosphere

Earth System History Variables

v0.4.1
CC BY 4.0
Authors
Adam T. Kocsis, Nussaibah B. Raja
Initial release
2021-04-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.