Learn R Programming

ADtools (version 0.5.4)

upper_tri_matrix: Construct an upper triangular matrix from a vector

Description

Construct an upper triangular matrix from a vector

Usage

upper_tri_matrix(data, nrow = 1, ncol = 1, diag = FALSE)

# S4 method for dual upper_tri_matrix(data, nrow = 1, ncol = 1, diag = FALSE)

Arguments

data

A numeric vector.

nrow

A positive integer; the desired number of rows.

ncol

A positive integer; the desired number of rows.

diag

A logical; should the diagonal be included ?

Examples

Run this code
# NOT RUN {
upper_tri_matrix(1:3, 3, 3)
upper_tri_matrix(1:6, 3, 3, diag = TRUE)

# }

Run the code above in your browser using DataLab