Learn R Programming

pervasive (version 1.0)

OPCP_mat: Calculate Observed Proportion of Concordant Pairs (OPCP)

Description

This function provides a matrix that contains Pearson correlations in the lower triangle and Observed Proportions of Concordant Pairs (OPCPs) in the upper triangle between multiple variables.

Usage

OPCP_mat(data, round_digits = 2)

Value

A matrix of correlations and OPCPs.

Arguments

data

A data frame containing the variables specified in the formula.

round_digits

The number of decimals to be included in the resulting table.

Examples

Run this code
# Example using the spi dataset from the psychTools package
sc <- psych::scoreVeryFast(psychTools::spi.keys, psychTools::spi)
spi_sc <- cbind(psychTools::spi, sc)
spi_sc_age_sex_B5 <- spi_sc |>
  dplyr::select(age, sex, Agree, Consc, Neuro, Extra, Open)


OPCP_mat(data = spi_sc_age_sex_B5)

Run the code above in your browser using DataLab