cor_df2_long: Calculate correlation between two data.frames and create a...

cor_df2_longR Documentation

Calculate correlation between two data.frames and create a long data.frame as output

Description

Calculate correlation between two data.frames and create a long data.frame as output

Usage

cor_df2_long(df1, df2, id_cols1, id_cols2)

Arguments

df1

first data.frame

df2

second data.frame

id_cols1

columns which are not features (descriptors) in the first data.frame

id_cols2

columns which are not features (descriptors) in the second data.frame

Details

all columns which are not included in 'id_cols' will be used for calculation of correlation. The number of feature columns should be identical in both data.frames.

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

d1 <- data.frame(name = LETTERS[1:4], x = rnorm(4), y = rnorm(4), z = rnorm(4))
d2 <- data.frame(name = LETTERS[5:7], x = rnorm(3), y = rnorm(3), z = rnorm(3))
df <- cor_df2_long(d1, d2, "name", "name")

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