Read a correlation, or any square, matrix into R. The resulting matrix is named mycor
. All coefficients for each variable must be on one row. No variable names are in the file to be read. The coefficients within each row, that is, for a single variable, are delimited by a white space, such as one or more blanks.
The standard R function used to read the matrix is read.table
.
By default the variables are named V1, V2, etc. If the names
option is invoked, then the specified names are attached to the respective rows and columns of the matrix. Here it may be convenient to name the variables with the lessR
function to
.
The alternative is to calculate the correlations from the data, such as with the lessR
function Correlation
or the standard R function cor
.