stretch | R Documentation |
stretch
is a specified implementation of tidyr::gather() to be applied
to a correlation data frame. It will gather the columns into a long-format
data frame. The term column is handled automatically.
stretch(x, na.rm = FALSE, remove.dups = FALSE)
x |
cor_df. See |
na.rm |
Boolean. Whether rows with an NA correlation (originally the matrix diagonal) should be dropped? Will automatically be set to TRUE if mirror is FALSE. |
remove.dups |
Removes duplicate entries, without removing all NAs |
tbl with three columns (x and y variables, and their correlation)
x <- correlate(mtcars) stretch(x) # Convert all to long format stretch(x, na.rm = TRUE) # omit NAs (diagonal in this case) x <- shave(x) # use shave to set upper triangle to NA and then... stretch(x, na.rm = TRUE) # omit all NAs, therefore keeping each # correlation only once.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.