cor_df2_long | R Documentation |
Calculate correlation between two data.frames and create a long data.frame as output
cor_df2_long(df1, df2, id_cols1, id_cols2)
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 |
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.
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
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.