Learn R Programming

ramify (version 0.3.3)

eye: Identity Matrix

Description

Creates an nrow-by-ncol identity matrix.

Usage

eye(nrow = 1, ncol = nrow)

Arguments

nrow
The desired number of rows.
ncol
The desired number of columns.

Value

A nrow-by-ncol identity matrix.

See Also

diag.

Examples

Run this code
eye(4)  # 4-by-4 identity matrix
eye(4, 4)  # 4-by-4 identity matrix
eye(3, 5)  # 3-by-5 identity matrix
eye(5, 3)  # 5-by-3 identity matrix

Run the code above in your browser using DataLab