multiCor: multiCor compute correlation coefficients for one response...

View source: R/multiCor.R

multiCorR Documentation

multiCor compute correlation coefficients for one response variable vs multiple predictor (independent) variables. The output is a dataframe ordered by highest to lowest correlation

Description

multiCor compute correlation coefficients for one response variable vs multiple predictor (independent) variables. The output is a dataframe ordered by highest to lowest correlation

Usage

multiCor(df, response, IVs, method = "spearman")

Arguments

df

is dataframe with response variable and predictor variables

response

is a character string that is the name of the response variable in df

IVs

is a vector of character strings that are the independent variables in df

method

is either "spearman" (nonparametric) or "pearson" (parametric)

Value

z dataframe with the variable name in column 1 and correlation coefficient in column 2. The dataframe is ordered from greatest correlation to least correlation.

Examples

data <- dfOptical
multiCor(data,"logEColi",names(data)[-1],"spearman")

USGS-R/USGSHydroTools documentation built on April 17, 2023, 8:09 p.m.