makeUnit: makeUnit generates a unit matrix whose diagonal can be...

View source: R/rutils.R

makeUnitR Documentation

makeUnit generates a unit matrix whose diagonal can be changed

Description

makeUnit generates a unit matrix but includes the facility to alter the diagonal value away from 1.0 if desired.

Usage

makeUnit(N, diagvalue = 1)

Arguments

N

the order of the matrix

diagvalue

defaults to 1.0, but otherwise can be a different constant or a vector of dimension N

Value

a square matrix defaulting to a unit matrix

Examples

## Not run: 
  makeUnit(4)
  surv <- exp(-0.2)
  makeUnit(4,surv)

## End(Not run)

haddonm/codeutils documentation built on April 15, 2024, 1:02 p.m.