Learn R Programming

scorematchingad (version 0.1.1)

rsymmetricmatrix: Quickly Generate a Symmetric Matrix for Testing and Examples

Description

A simple function for generating a symmetric matrix for use in examples. The diagonal, and upper-triangular elements of the matrix are simulated independently from a uniform distribution. The lower-triangle of the output matrix is copied from the upper-triangle. These matrices do not represent the full range of possible symmetric matrices.

Usage

rsymmetricmatrix(p, min = 0, max = 1)

Value

A p x p symmetric matrix.

Arguments

p

The desired dimension of the matrix

min

The minimum of the uniform distribution.

max

The maximum of the uniform distribution

Examples

Run this code
rsymmetricmatrix(5)

Run the code above in your browser using DataLab