Description Usage Arguments Details Value Examples

Create a diagonal matrix from a character vector

1 2 |

`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. |

We create a new method for `diag`

with character input. 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".

A matrix

1 |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.