set_diag {holodeck}R Documentation

Pipe friendly wrapper to 'diag(x) <- value'

Description

Pipe friendly wrapper to 'diag(x) <- value'

Usage

set_diag(x, value)

Arguments

x

a matrix

value

either a single value or a vector of length equal to the diagonal of 'x'.

Value

a matrix

Examples

library(dplyr)
matrix(0,3,3) %>%
set_diag(1)

[Package holodeck version 0.2.2 Index]