Learn R Programming

MultBiplotR (version 23.11.0)

diagonal: Diagonal matrix from a vector

Description

Creates a diagonal matrix from a vector

Usage

diagonal(d)

Value

A diagonal matrix wirh the values of vector in the diagonal a zeros elsewhere

Arguments

d

A numerical vector

Author

Jose Luis Vicente Villardon

Examples

Run this code
diag(c(1, 2, 3, 4, 5))

Run the code above in your browser using DataLab