covariance | R Documentation |
This function calculates the covariance between two vectors of numbers.
covariance(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 covariance 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
covariance(data, data2)
# Learning mode
covariance(data, data2, learn = TRUE)
# Interactive mode
if(interactive()){
covariance(interactive = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.