geometric_mean: Geometric Mean Function

View source: R/geometric_mean.R

geometric_meanR Documentation

Geometric Mean Function

Description

This function calculates the geometric mean of a numeric vector. Can be used in three modes: simple calculation, learning mode with step-by-step explanation, or interactive mode for practice.

Usage

geometric_mean(x = NULL, learn = FALSE, interactive = FALSE)

Arguments

x

Optional 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 geometric mean of the vector (for non-interactive mode)

Examples

data <- c(5,21,12,7,3,9,1)
# Simple calculation
geometric_mean(data)

# Learning mode
geometric_mean(data, learn = TRUE)

# Interactive mode
if(interactive()){
geometric_mean(interactive = TRUE)
}


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