single_correlation_table: Calculate all pairwise correlations of one dimensions with...

single_correlation_tableR Documentation

Calculate all pairwise correlations of one dimensions with one or many others and directly obtain a CSV table

Description

This function allows to calculating all pairwise correlations of one dimensions with one or many others and directly obtain a CSV table.

Usage

single_correlation_table(
  MainFactor, 
  CorrelationFactors, 
  name = "", 
  mainFactorName = ""
  )

Arguments

MainFactor

a vector with which the correlations will be determined

CorrelationFactors

a data frame with one or several different variables that will be correlated to the main factor

name

name of the file in which the generated table is saved

mainFactorName

name of the main factor for better labelling

References

Frank E Harrell Jr (2021). Hmisc: Harrell Miscellaneous. R package version 4.6-0. https://CRAN.R-project.org/package=Hmisc

Examples

# Dummy data frame generation
df <- data.frame(x = 1:5, y = 2:6, z = 19:23)

# Assume we want to correlate z with all other columns
single_correlation_table(MainFactor = df$z, CorrelationFactors = df[,1:2])

samueltobler/behavdata documentation built on July 9, 2024, 11:33 a.m.