
Last chance! 50% off unlimited learning
Sale ends in
Abbreviation: rd.cor
Read a correlation 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.
corRead(ref=NULL, names=NULL)rd.cor(…)
File reference, either omitted to browse for the data file,
or a full path name or web URL, included in quotes. A URL
begins with http://
.
The names of the variables in the matrix.
Parameter values.
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
.
Gerbing, D. W. (2014). R Data Analysis without Programming, Chapter 8, NY: Routledge.
# NOT RUN {
# browse for the data file because ref is omitted
# name the variables with the lessR function to
# mycor <- corRead(names=to("m",20))
# abbreviated form
# read a matrix with 4 variables and specify the names
# mycor <- rd.cor(names=c("m06","m07","m09","m10"))
# }
Run the code above in your browser using DataLab