Learn R Programming

PReMiuM (version 3.0.24)

vec2mat: Vector to upper triangular matrix

Description

Function to convert a vector to an upper triangular matrix. The vector does not include the diagonal values, which are then set equal to 1 in the matrix. The matrix is filled by row.

Usage

vec2mat(data = NA, nrow = 1)

Arguments

data
The vector to be converted, excluding the diagonal which is set equal to 1.
nrow
The number of rows (and columns) of the resulting matrix.

Value

  • The symmetric matrix. The matrix is filled by column.

Authors

Silvia Liverani, Department of Epidemiology and Biostatistics, Imperial College London and MRC Biostatistics Unit, Cambridge, UK

Maintainer: Silvia Liverani

References

Liverani, S., Hastie, D. I., Azizi, L., Papathomas, M. and Richardson, S. (2013) PReMiuM: An R package for Profile Regression Mixture Models using Dirichlet Processes. Submitted. Available at http://uk.arxiv.org/abs/1303.2836

Examples

Run this code
vec2mat(data=c(1,2,3),nrow=3)

Run the code above in your browser using DataLab