sub.range: Calculate the Range Difference of a Numeric Vector

View source: R/aided_chatgpt.R

sub.rangeR Documentation

Calculate the Range Difference of a Numeric Vector

Description

This function calculates the difference between the maximum and minimum values of a numeric vector.

Usage

sub.range(x)

Arguments

x

A numeric vector for which the range difference is to be calculated.

Value

A numeric value representing the difference between the maximum and minimum values of the input vector. Returns 'NA' if the input is empty or contains only 'NA' values.

Examples

# Example with a numeric vector
numeric_vector <- c(1, 5, 3, 8, 2)
sub.range(numeric_vector)

# Example with missing values
sub.range(c(NA, 4, 7, NA, 10))


quickcode documentation built on April 11, 2025, 5:49 p.m.