cor_df_long: Calculate correlation within a data.frame and create a long...

View source: R/functions.R

cor_df_longR Documentation

Calculate correlation within a data.frame and create a long data.frame as output

Description

Calculate correlation within a data.frame and create a long data.frame as output

Usage

cor_df_long(df, id_cols)

Arguments

df

data.frame

id_cols

columns which are not features (descriptors)

Details

all columns which are not included in 'id_cols' will be used for calculation of correlation.

Value

returns a long data.frame with additional columns: 'id1' and 'id2' (referencing to the row number of the original data.frame) and 'id_cols' with appended '.x' and '.y' suffixes. The column 'value' will contain correlation coefficient

Examples

d <- data.frame(name = LETTERS[1:4], x = rnorm(4), y = rnorm(4), z = rnorm(4))
df <- cor_df_long(d, "name")

DrrDom/pfpp documentation built on April 17, 2024, 10:24 a.m.