covariance: Covariance Function

View source: R/covariance.R

covarianceR Documentation

Covariance Function

Description

This function calculates the covariance between two vectors of numbers.

Usage

covariance(x = NULL, y = NULL, learn = FALSE, interactive = FALSE)

Arguments

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

Value

The covariance between the two vectors (for non-interactive mode)

Examples

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)
}


UAHDataScienceSF documentation built on April 3, 2025, 10:44 p.m.