Determine the Pearson correlation coefficient between two variables in a data frame using pipeable and formula-friendly syntax
get_correlation(data, formula)
a data frame object
a formula with the response variable name on the left and the explanatory variable name on the right
A 1x1 data frame storing the correlation value
# NOT RUN { library(moderndive) # Compute correlation between mpg and cyl: mtcars %>% get_correlation(formula = mpg ~ cyl) # }
Run the code above in your browser using DataLab