band: Get Band

Description Usage Arguments Details Value See Also Examples

View source: R/contactGroup_utils.R

Description

Get or set band from matrix.

Usage

1
2
band(mat, band.no)
band(mat, band.no) <- value

Arguments

mat

A matrix.

band.no

Integer specifying which matrix band. band.no = 1 retrieves the main diagonal.

value

A scalar or vector equal in length to the matrix band.

Details

A matrix band is the set of elements in a matrix from a specific off-diagonal.

Value

A matrix band in the form of a vector.

See Also

getBandIdx

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
mat <- matrix(1:9, 3, 3)
band(mat, band.no = 2)
mat
band(mat, band.no = 2) <- c(9,10)
mat

data(cgEx)
tact.1 <- contacts(cgEx)[[1]]
b2 <- band(tact.1, 2)
band(tact.1, 2) <- b2

bnbc documentation built on Nov. 8, 2020, 8:15 p.m.