ocorr: Olito's Correlation

View source: R/opwcorr.r

ocorrR Documentation

Olito's Correlation

Description

Calculate correlations by transforming variables into a matrix and then use of hmisc package the rest is data management. Calculates pearson and spearman. Wrapper from Stata.

Usage

ocorr(
  target = NULL,
  indep = NULL,
  grpvar = NULL,
  data = NULL,
  type = "pearson"
)

Arguments

target

target variables

indep

independent variables, if NULL: target vars will fill this parameter

grpvar

Group variable (only one)

data

data frame

type

Type of correltation "pearson" o "spearman"

Value

data frame

Examples

# library(dplyr); library(Hmisc)
# ocorr("mpg", "hp", data = mtcars, type = "spearman")
# ocorr(c("mpg", "cyl", "qsec"), c("drat", "hp", "wt"), data = mtcars, grpvar = "am")
# ocorr(c("mpg", "cyl", "qsec"), data = mtcars)

olitroski/olibrary documentation built on Oct. 20, 2022, 2:42 p.m.