View source: R/pearson_correlation_coefficient.R
pearson | R Documentation |
This function calculates the Pearson correlation coefficient between two vectors of numbers.
pearson(x = NULL, y = NULL, learn = FALSE, interactive = FALSE)
x |
Optional first numeric vector (not needed for interactive mode) |
y |
Optional second numeric vector (not needed for interactive mode) |
learn |
Logical, if TRUE shows step-by-step explanation |
interactive |
Logical, if TRUE enables interactive practice mode |
The Pearson correlation coefficient between the two vectors (for non-interactive mode)
data <- c(10,4,5,7,3,4,1)
data2 <- c(1,8,3,4,4,5,7)
# Simple calculation
pearson(data, data2)
# Learning mode
pearson(data, data2, learn = TRUE)
# Interactive mode
if(interactive()){
pearson(interactive = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.