diagn: Extract or construct a diagonal matrix.

Description Usage Arguments Value See Also Examples

View source: R/diagn.R

Description

This works like diag except when x is a single integer value. If x is a single integer value then it assumes that you want a 1 by 1 matrix with the value set to x

Usage

1
diagn(x = 1, nrow = length(x), ncol = nrow)

Arguments

x

a matrix, vector or 1D array, or missing.

nrow, ncol

optional dimensions for the result when x is not a matrix.

Value

matrix with diagonal elements set to x

See Also

diag

Examples

1
2
diag(5)
diagn(5)

PResiduals documentation built on June 24, 2021, 9:10 a.m.