diag-character-method: Create a diagonal matrix from a character vector

Description Usage Arguments Details Examples

Description

Create a diagonal matrix from a character vector

Usage

1
2
## S4 method for signature 'character'
diag(x = 1, nrow, ncol)

Arguments

x

Character vector used to create the matrix

nrow

Numeric. Number of rows for the resulting matrix.

ncol

Numeric. Number of columns for the resulting matrix.

Details

The default behavior for missing nrow and/or ncol arguments is the same as for the diag function in the base package. Off-diagonal entries are filled with "0".

Examples

1
diag(letters[1:3])


Search within the dynr package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.