Press "Enter" to skip to content

Using Focus() On Correlations

Simon Jackson explains how to use the focus() function in R to narrow down a data frame of correlation coefficients based on a subset of variables:

focus() works similarly to select() from the dplyr package (which is loaded along with the corrr package). You add the names of the columns you wish to keep in your correlation data frame. Extending select(), focus()will then remove the remaining column variables from the rows. This is whympg does not appear in the rows above. Here’s another example with two variables:

Click through for the entire article.