Learn R Programming

OpenRepGrid (version 0.1.15)

constructCor: Calculate correlations between constructs.

Description

Different types of correlations can be requested: PMC, Kendall tau rank correlation, Spearman rank correlation.

Usage

constructCor(
  x,
  method = c("pearson", "kendall", "spearman"),
  trim = 20,
  index = FALSE
)

Value

Returns a matrix of construct correlations.

Arguments

x

repgrid object.

method

A character string indicating which correlation coefficient is to be computed. One of "pearson" (default), "kendall" or "spearman", can be abbreviated. The default is "pearson".

trim

The number of characters a construct is trimmed to (default is 20). If NA no trimming occurs. Trimming simply saves space when displaying correlation of constructs with long names.

index

Whether to print the number of the construct.

See Also

elementCor()

Examples

Run this code

# three different types of correlations
constructCor(mackay1992)
constructCor(mackay1992, method = "kendall")
constructCor(mackay1992, method = "spearman")

# format output
constructCor(mackay1992, trim = 6)
constructCor(mackay1992, index = TRUE, trim = 6)

# save correlation matrix for further processing
r <- constructCor(mackay1992)
r
print(r, digits = 5)

# accessing the correlation matrix
r[1, 3]

Run the code above in your browser using DataLab