From eb4118ca58c9405eafeb1babc318a59457458e52 Mon Sep 17 00:00:00 2001 From: lilyclements Date: Wed, 20 Nov 2024 13:57:01 +0000 Subject: [PATCH 1/3] adding summary functions.R stand alone functions --- NAMESPACE | 95 ++ R/summary_functions.R | 1690 ++++++++++++++++++++++++++++++++++ man/BIAS.Rd | 25 + man/EDI.Rd | 25 + man/p10.Rd | 25 + man/summary_mean_circular.Rd | 31 + 6 files changed, 1891 insertions(+) create mode 100644 R/summary_functions.R create mode 100644 man/BIAS.Rd create mode 100644 man/EDI.Rd create mode 100644 man/p10.Rd create mode 100644 man/summary_mean_circular.Rd diff --git a/NAMESPACE b/NAMESPACE index 11a3cef..4474ba1 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,7 +1,102 @@ # Generated by roxygen2: do not edit by hand export("%>%") +export(BIAS) export(DataSheet) +export(EDI) +export(EDS) +export(ETS) +export(FAR) +export(GS) +export(HSS) +export(KGE) +export(NSE) +export(PBIAS) +export(PC) +export(PODy) +export(R2) +export(SEDI) +export(SEDS) +export(TS) +export(VE) +export(count_calc) +export(cp) +export(d) +export(hss) export(instat_comment) export(link) +export(mNSE) +export(mae) +export(md) +export(me) +export(mse) +export(nrmse) +export(p10) +export(p20) +export(p25) +export(p30) +export(p33) +export(p40) +export(p60) +export(p67) +export(p70) +export(p75) +export(p80) +export(p90) +export(pc) +export(proportion_calc) +export(pss) +export(rNSE) +export(rSD) +export(rd) +export(rmse) +export(rsr) +export(ssq) +export(standard_error_mean) +export(summary_Q1_circular) +export(summary_Q3_circular) +export(summary_Qn) +export(summary_Sn) +export(summary_ang_dev_circular) +export(summary_ang_var_circular) +export(summary_coef_var) +export(summary_cor) +export(summary_count) +export(summary_count_missing) +export(summary_count_non_missing) +export(summary_cov) +export(summary_first) +export(summary_kurtosis) +export(summary_last) +export(summary_max) +export(summary_max_circular) +export(summary_mean) +export(summary_mean_circular) +export(summary_median) +export(summary_medianHL_circular) +export(summary_median_absolute_deviation) +export(summary_median_circular) +export(summary_min) +export(summary_min_circular) +export(summary_n_distinct) +export(summary_nth) +export(summary_outlier_limit) +export(summary_quantile) +export(summary_quantile_circular) +export(summary_range) +export(summary_range_circular) +export(summary_rho_circular) +export(summary_sample) +export(summary_sd) +export(summary_sd_circular) +export(summary_skewness) +export(summary_skewness_mc) +export(summary_sum) +export(summary_trimmed_mean) +export(summary_var) +export(summary_var_circular) +export(summary_where_max) +export(summary_where_min) +export(summary_which_max) +export(summary_which_min) importFrom(magrittr,"%>%") diff --git a/R/summary_functions.R b/R/summary_functions.R new file mode 100644 index 0000000..6022dd9 --- /dev/null +++ b/R/summary_functions.R @@ -0,0 +1,1690 @@ +#' Calculate the Mean of Circular Data +#' +#' Computes the mean of circular data using `circular::mean.circular`. +#' +#' @param x A vector of circular data. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param control.circular List of control parameters for circular objects. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The mean of the circular data. +#' @export +summary_mean_circular <- function (x, na.rm = FALSE, control.circular = list(), na_type = "", ...) { + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else return(circular::mean.circular(x, na.rm = na.rm, trim = trim, control.circular = control.circular)[[1]]) +} + + + +#' Calculate the Median of Circular Data +#' +#' Computes the median of circular data using `circular::median.circular`. +#' +#' @param x A vector of circular data. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The median of the circular data. +#' @export +summary_median_circular <- function (x, na.rm = FALSE, na_type = "", ...) { + if(!na.rm & anyNA(x)) return(NA) + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else return(circular::median.circular(x, na.rm = na.rm)[[1]]) +} + +#' Calculate the Hodges-Lehmann Median of Circular Data +#' +#' Computes the Hodges-Lehmann median of circular data using `circular::medianHL.circular`. +#' +#' @param x A vector of circular data. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param method Character string specifying the HL method ("HL1", "HL2", or "HL3"). +#' @param prop Numeric. Proportion of data to consider. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The Hodges-Lehmann median of the circular data. +#' @export +summary_medianHL_circular <- function (x, na.rm = FALSE, method = c("HL1","HL2","HL3"), prop = NULL, na_type = "", ...) { + if(!na.rm & anyNA(x)) return(NA) + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else return(circular::medianHL.circular(x, na.rm = na.rm, method = method, prop = prop)[[1]]) +} + +#' Calculate the Minimum of Circular Data +#' +#' Computes the minimum value of circular data using `circular::quantile.circular`. +#' +#' @param x A vector of circular data. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param names Logical. Should the names of the quantiles be returned? Defaults to `FALSE`. +#' @param type Integer. Type of quantile calculation. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The minimum of the circular data. +#' @export +summary_min_circular <- function (x, na.rm = FALSE, names = FALSE, type = 7, na_type = "", ...) { + if(length(x)==0 || (na.rm && length(x[!is.na(x)])==0)||(!na.rm & anyNA(x))) return(NA) + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else return(circular::quantile.circular(x, probs = 0, na.rm = na.rm, names = names, type = type)[[1]]) +} + +#' Calculate the Maximum of Circular Data +#' +#' Computes the maximum value of circular data using `circular::quantile.circular`. +#' +#' @param x A vector of circular data. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param names Logical. Should the names of the quantiles be returned? Defaults to `FALSE`. +#' @param type Integer. Type of quantile calculation. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The maximum of the circular data. +#' @export +summary_max_circular <- function (x, na.rm = FALSE, names = FALSE, type = 7, na_type = "", ...) { + if(length(x)==0 || (na.rm && length(x[!is.na(x)])==0)||(!na.rm & anyNA(x))) return(NA) + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else return(circular::quantile.circular(x, probs = 1, na.rm = na.rm, names = names, type = type)[[1]]) +} + +#' Calculate Quantiles of Circular Data +#' +#' Computes the quantiles of circular data using `circular::quantile.circular`. +#' +#' @param x A vector of circular data. +#' @param probs Numeric vector of probabilities. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param names Logical. Should the names of the quantiles be returned? Defaults to `FALSE`. +#' @param type Integer. Type of quantile calculation. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The quantiles of the circular data. +#' @export +summary_quantile_circular <- function (x, probs = seq(0, 1, 0.25), na.rm = FALSE, names = FALSE, type = 7, na_type = "", ...) { + if(length(x)==0 || (na.rm && length(x[!is.na(x)])==0)||(!na.rm & anyNA(x))) return(NA) + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else return(circular::quantile.circular(x, probs = probs, na.rm = na.rm, names = names, type = type)[[1]]) +} + +#' Calculate the Third Quartile of Circular Data +#' +#' Computes the third quartile (Q3) of circular data using `circular::quantile.circular`. +#' +#' @param x A vector of circular data. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param names Logical. Should the names of the quantiles be returned? Defaults to `FALSE`. +#' @param type Integer. Type of quantile calculation. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The third quartile of the circular data. +#' @export +summary_Q3_circular <- function (x, na.rm = FALSE, names = FALSE, type = 7, na_type = "", ...) { + if(length(x)==0 || (na.rm && length(x[!is.na(x)])==0)||(!na.rm & anyNA(x))) return(NA) + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else return(circular::quantile.circular(x, probs = 0.75, na.rm = na.rm, names = names, type = type)[[1]]) +} + +#' Calculate the First Quartile of Circular Data +#' +#' Computes the first quartile (Q1) of circular data using `circular::quantile.circular`. +#' +#' @param x A vector of circular data. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param names Logical. Should the names of the quantiles be returned? Defaults to `FALSE`. +#' @param type Integer. Type of quantile calculation. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The first quartile of the circular data. +#' @export +summary_Q1_circular <- function (x, na.rm = FALSE, names = FALSE, type = 7, na_type = "", ...) { + if(length(x)==0 || (na.rm && length(x[!is.na(x)])==0)||(!na.rm & anyNA(x))) return(NA) + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else return(circular::quantile.circular(x, probs = 0.25, na.rm = na.rm, names = names, type = type)[[1]]) +} + +#' Calculate the Standard Deviation of Circular Data +#' +#' Computes the standard deviation of circular data using `circular::sd.circular`. +#' +#' @param x A vector of circular data. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The standard deviation of the circular data. +#' @export +summary_sd_circular <- function (x, na.rm = FALSE, na_type = "", ...) { + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else return(circular::sd.circular(x, na.rm = na.rm)) +} + +#' Calculate the Variance of Circular Data +#' +#' Computes the variance of circular data using `circular::var.circular`. +#' +#' @param x A vector of circular data. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The variance of the circular data. +#' @export +summary_var_circular <- function (x, na.rm = FALSE, na_type = "", ...) { + if(length(x)==0 || (na.rm && length(x[!is.na(x)])==0)) return(NA) + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else return(circular::var.circular(x, na.rm = na.rm)) +} + +#' Calculate Angular Deviation of Circular Data +#' +#' Computes the angular deviation of circular data using `circular::angular.deviation`. +#' +#' @param x A vector of circular data. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The angular deviation of the circular data. +#' @export +summary_ang_dev_circular <- function (x, na.rm = FALSE, na_type = "", ...) { + if(length(x)==0 || (na.rm && length(x[!is.na(x)])==0)) return(NA) + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else return(circular::angular.deviation(x, na.rm = na.rm)) +} + + +#' Calculate Angular Variance of Circular Data +#' +#' Computes the angular variance of circular data using `circular::angular.variance`. +#' +#' @param x A vector of circular data. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The angular variance of the circular data. +#' @export +summary_ang_var_circular <- function (x, na.rm = FALSE, na_type = "", ...) { + if(length(x)==0 || (na.rm && length(x[!is.na(x)])==0)) return(NA) + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else return(circular::angular.variance(x, na.rm = na.rm)) +} + +#' Calculate Range of Circular Data +#' +#' Computes the range of circular data using `circular::range.circular`. +#' +#' @param x A vector of circular data. +#' @param test Logical. Perform a statistical test on the range. Defaults to `FALSE`. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param finite Logical. Should only finite values be considered? Defaults to `FALSE`. +#' @param control.circular List of control parameters for circular objects. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The range of the circular data. +#' @export +summary_range_circular <- function (x, test = FALSE, na.rm = FALSE, finite = FALSE, control.circular = list(), na_type = "", ...) { + if(length(x)==0 || (na.rm && length(x[!is.na(x)])==0)) return(NA) + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else return(circular::range.circular(x, test = test, na.rm = na.rm, finite = finite, control.circular = control.circular)[[1]]) +} + +#' Calculate Rho of Circular Data +#' +#' Computes the Rho (mean resultant length) of circular data using `circular::rho.circular`. +#' +#' @param x A vector of circular data. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The Rho of the circular data. +#' @export +summary_rho_circular <- function (x, na.rm = FALSE, na_type = "", ...) { + if(length(x)==0 || (na.rm && length(x[!is.na(x)])==0)) return(NA) + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else return(circular::rho.circular(x, na.rm = na.rm)) +} + +#' Calculate Mean of Data +#' +#' Computes the mean or weighted mean of a dataset. +#' +#' @param x A numeric vector. +#' @param add_cols Additional columns (not used directly in calculation). +#' @param weights Optional weights for the data. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param trim Numeric. Fraction of observations to trim from each end before computing the mean. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The mean or weighted mean of the data. +#' @export +summary_mean <- function (x, add_cols, weights = NULL, na.rm = FALSE, trim = 0, na_type = "", ...) { + if( length(x)==0 || (na.rm && length(x[!is.na(x)])==0) ) return(NA) + else { + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else { + if (missing(weights) || is.null(weights)) + return(mean(x, na.rm = na.rm, trim = trim)) + else + return(stats::weighted.mean(x, w = weights, na.rm = na.rm)) + } + } +} + +#' Calculate Trimmed Mean of Data +#' +#' Computes the trimmed mean of a dataset. +#' +#' @param x A numeric vector. +#' @param add_cols Additional columns (not used directly in calculation). +#' @param weights Optional weights for the data. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param trimmed Numeric. Fraction of observations to trim from each end before computing the mean. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The trimmed mean of the data. +#' @export +summary_trimmed_mean <- function (x, add_cols, weights = NULL, na.rm = FALSE, trimmed = 0, na_type = "", ...) { + if( length(x)==0 || (na.rm && length(x[!is.na(x)])==0) ) return(NA) + else { + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else + return(mean(x, na.rm = na.rm, trim = trimmed)) + } +} + +#' Calculate Sum of Data +#' +#' Computes the sum or weighted sum of a dataset. +#' +#' @param x A numeric vector. +#' @param weights Optional weights for the data. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The sum or weighted sum of the data. +#' @export +summary_sum <- function (x, weights = NULL, na.rm = FALSE, na_type = "", ...) { + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else { + if (missing(weights) || is.null(weights)) return(sum(x, na.rm = na.rm)) + else return(sum(x * weights, na.rm = na.rm)) + } +} + +#' Count Elements in a Dataset +#' +#' Counts the number of elements in a dataset. +#' +#' @param x A vector of data. +#' @param ... Additional arguments (not used). +#' @return The count of elements in the dataset. +#' @export +summary_count <- function(x, ...) { + return(length(x)) +} + +#' Count Missing Elements in a Dataset +#' +#' Counts the number of missing (NA) elements in a dataset. +#' +#' @param x A vector of data. +#' @param ... Additional arguments (not used). +#' @return The count of missing elements in the dataset. +#' @export +summary_count_missing <- function(x, ...) { + return(sum(is.na(x))) +} + +#' Count Non-Missing Elements +#' +#' Counts the number of non-missing (non-NA) elements in a dataset. +#' +#' @param x A vector of data. +#' @param ... Additional arguments (not used). +#' @return The count of non-missing elements in the dataset. +#' @export +summary_count_non_missing <- function(x, ...) { + return(sum(!is.na(x))) +} + +#' Calculate Standard Deviation +#' +#' Computes the standard deviation or weighted standard deviation of a dataset. +#' +#' @param x A numeric vector. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param weights Optional weights for the data. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The standard deviation or weighted standard deviation of the data. +#' @export +summary_sd <- function(x, na.rm = FALSE, weights = NULL, na_type = "", ...) { + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if (missing(weights) || is.null(weights)) { + return(sd(x, na.rm = na.rm)) + } else { + return(sqrt(Hmisc::wtd.var(x, weights = weights, na.rm = na.rm))) + } + } +} + +#' Calculate Variance +#' +#' Computes the variance or weighted variance of a dataset. +#' +#' @param x A numeric vector. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param weights Optional weights for the data. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The variance or weighted variance of the data. +#' @export +summary_var <- function(x, na.rm = FALSE, weights = NULL, na_type = "", ...) { + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if (missing(weights) || is.null(weights)) { + return(var(x,na.rm = na.rm)) + } + else { + return(Hmisc::wtd.var(x, weights = weights, na.rm = na.rm)) + } + } +} + +#' Calculate Maximum Value +#' +#' Computes the maximum value in a dataset. +#' +#' @param x A numeric vector. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The maximum value in the dataset. +#' @export +summary_max <- function (x, na.rm = FALSE, na_type = "", ...) { + #TODO This prevents warning and -Inf being retured. Is this desirable? + if(length(x)==0 || (na.rm && length(x[!is.na(x)])==0)) return(NA) + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + return(max(x, na.rm = na.rm)) + } +} + +#' Calculate Minimum Value +#' +#' Computes the minimum value in a dataset. +#' +#' @param x A numeric vector. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The minimum value in the dataset. +#' @export +summary_min <- function (x, na.rm = FALSE, na_type = "", ...) { + #TODO This prevents warning and Inf being retured. Is this desirable? + if(length(x)==0 || (na.rm && length(x[!is.na(x)])==0)) return(NA) + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + return(min(x, na.rm = na.rm)) + } +} + +#' Get Indices of Maximum Value +#' +#' Finds all indices of the maximum value in a dataset. +#' +#' @param x A numeric vector. +#' @param na.rm Logical. Should missing values be removed? Defaults to `TRUE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return A vector of indices corresponding to the maximum value. +#' @export +summary_which_max <- function (x, na.rm = TRUE, na_type = "", ...) { + if(length(x)==0 || (na.rm && length(x[!is.na(x)])==0)) return(NA) + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + # Get the minimum value + max_value <- max(x, na.rm = na.rm) + # Return all indices where x is equal to the minimum value + return(which(x == max_value)) + } +} + +#' Get Indices of Minimum Value +#' +#' Finds all indices of the minimum value in a dataset. +#' +#' @param x A numeric vector. +#' @param na.rm Logical. Should missing values be removed? Defaults to `TRUE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return A vector of indices corresponding to the minimum value. +#' @export +summary_which_min <- function(x, na.rm = TRUE, na_type = "", ...) { + if(length(x) == 0 || (na.rm && length(x[!is.na(x)]) == 0)) return(NA) + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else { + # Get the minimum value + min_value <- min(x, na.rm = na.rm) + # Return all indices where x is equal to the minimum value + return(which(x == min_value)) + } +} + +#' Get Corresponding Value for Maximum +#' +#' Returns the value in another vector corresponding to the maximum value in a dataset. +#' +#' @param x A numeric vector. +#' @param summary_where_y A vector of values corresponding to `x`. +#' @param na.rm Logical. Should missing values be removed? Defaults to `TRUE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The value in `summary_where_y` corresponding to the maximum value in `x`. +#' @export +summary_where_max <- function(x, summary_where_y=NULL, na.rm = TRUE, na_type = "", ...) { + # Check if vectors are empty + if (length(x) == 0 || length(summary_where_y) == 0) { + return(NA) + } + + # Handle NA values + if (na.rm) { + valid_indices <- !is.na(x) & !is.na(summary_where_y) + x <- x[valid_indices] + summary_where_y <- summary_where_y[valid_indices] + } + + # Find the index of the maximum value in x + max_index <- which.max(x) + + # Return the corresponding value in summary_where_y + return(summary_where_y[max_index]) +} + + +#' Get Corresponding Value for Minimum +#' +#' Returns the value in another vector corresponding to the minimum value in a dataset. +#' +#' @param x A numeric vector. +#' @param summary_where_y A vector of values corresponding to `x`. +#' @param na.rm Logical. Should missing values be removed? Defaults to `TRUE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The value in `summary_where_y` corresponding to the minimum value in `x`. +#' @export +summary_where_min <- function(x, summary_where_y=NULL, na.rm = TRUE, na_type = "", ...) { + # Check if vectors are empty + if (length(x) == 0 || length(summary_where_y) == 0) { + return(NA) + } + + # Handle NA values + if (na.rm) { + valid_indices <- !is.na(x) & !is.na(summary_where_y) + x <- x[valid_indices] + summary_where_y <- summary_where_y[valid_indices] + } + + # Find the index of the minimum value in x + min_index <- summary_which_min(x, na.rm = na.rm, na_type = na_type, ...) + + # Return the corresponding value in summary_where_y + return(summary_where_y[min_index]) +} + +#' Calculate Range +#' +#' Computes the range of a dataset (difference between the maximum and minimum values). +#' +#' @param x A numeric vector. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The range of the dataset. +#' @export +summary_range <- function(x, na.rm = FALSE, na_type = "", ...) { + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + return(max(x, na.rm = na.rm) - min(x, na.rm = na.rm)) + } +} + +#' Calculate Median +#' +#' Computes the median or weighted median of a dataset. Handles ordered factors and dates. +#' +#' @param x A numeric vector, ordered factor, or date. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param weights Optional weights for the data. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The median or weighted median of the dataset. +#' @export +summary_median <- function(x, na.rm = FALSE, weights = NULL, na_type = "", ...) { + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(missing(weights) || is.null(weights)) { + if (stringr::str_detect(class(x), pattern = "ordered") || stringr::str_detect(class(x), pattern = "Date")) { + return(quantile(x, na.rm = na.rm, probs = 0.5, type = 1)[[1]]) + } else { + return(median(x, na.rm = na.rm)) + } + } else { + return(Hmisc::wtd.quantile(x, weights = weights, probs = 0.5, na.rm = na.rm)) + } + } +} + +#' Calculate Quantile +#' +#' Computes the quantile or weighted quantile of a dataset. Handles ordered factors and dates. +#' +#' @param x A numeric vector, ordered factor, or date. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param weights Optional weights for the data. +#' @param probs Numeric vector of probabilities (e.g., 0.1 for 10th percentile). +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The quantile or weighted quantile of the dataset. +#' @export +summary_quantile <- function(x, na.rm = FALSE, weights = NULL, probs, na_type = "", ...) { + if(!na.rm && anyNA(x)) return(NA) + # This prevents multiple values being returned + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else { + if(missing(weights) || is.null(weights)) { + if (stringr::str_detect(class(x), pattern = "ordered") || stringr::str_detect(class(x), pattern = "Date")) { + return(quantile(x, na.rm = na.rm, probs = probs, type = 1)[[1]]) + } else { + return(quantile(x, na.rm = na.rm, probs = probs)[[1]]) + } + } + else { + return(Hmisc::wtd.quantile(x, weights = weights, probs = probs, na.rm = na.rm)) + } + } +} + +#' Calculate 10th Percentile +#' +#' Computes the 10th percentile of a dataset using `summary_quantile`. +#' +#' @inheritParams summary_quantile +#' @return The 10th percentile of the dataset. +#' @export +p10 <- function(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) { + summary_quantile(x = x, na.rm = na.rm, na_type = na_type, weights = weights, probs = 0.1, na_max_prop = na_max_prop, ...) +} + +#' Calculate 20th Percentile +#' +#' Computes the 20th percentile of a dataset using `summary_quantile`. +#' +#' @inheritParams summary_quantile +#' @return The 20th percentile of the dataset. +#' @export +p20 <- function(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL,...) { + summary_quantile(x = x, na.rm = na.rm, na_type = na_type, weights = weights, probs = 0.2, na_max_prop = na_max_prop, ...) +} + +#' Calculate 25th Percentile (First Quartile) +#' +#' Computes the 25th percentile of a dataset using `summary_quantile`. +#' +#' @inheritParams summary_quantile +#' @return The 25th percentile of the dataset. +#' @export +p25 <- function(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) { + summary_quantile(x = x, na.rm = na.rm, na_type = na_type, weights = weights, probs = 0.25, na_max_prop = na_max_prop, ...) +} + +#' Calculate 30th Percentile +#' +#' Computes the 30th percentile of a dataset using `summary_quantile`. +#' +#' @inheritParams summary_quantile +#' @return The 30th percentile of the dataset. +#' @export +p30 <- function(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) { + summary_quantile(x = x, na.rm = na.rm, na_type = na_type, weights = weights, probs = 0.3, na_max_prop = na_max_prop, ...) +} + +#' Calculate 33rd Percentile +#' +#' Computes the 33rd percentile of a dataset using `summary_quantile`. +#' +#' @inheritParams summary_quantile +#' @return The 33rd percentile of the dataset. +#' @export +p33 <- function(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) { + summary_quantile(x = x, na.rm = na.rm, na_type = na_type, weights = weights, probs = 0.33, na_max_prop = na_max_prop, ...) +} + +#' Calculate 40th Percentile +#' +#' Computes the 40th percentile of a dataset using `summary_quantile`. +#' +#' @inheritParams summary_quantile +#' @return The 40th percentile of the dataset. +#' @export +p40 <- function(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) { + summary_quantile(x = x, na.rm = na.rm, na_type = na_type, weights = weights, probs = 0.4, na_max_prop = na_max_prop, ...) +} + +#' Calculate 60th Percentile +#' +#' Computes the 60th percentile of a dataset using `summary_quantile`. +#' +#' @inheritParams summary_quantile +#' @return The 60th percentile of the dataset. +#' @export +p60 <- function(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) { + summary_quantile(x = x, na.rm = na.rm, na_type = na_type, weights = weights, probs = 0.6, na_max_prop = na_max_prop, ...) +} + +#' Calculate 67th Percentile +#' +#' Computes the 67th percentile of a dataset using `summary_quantile`. +#' +#' @inheritParams summary_quantile +#' @return The 67th percentile of the dataset. +#' @export +p67 <- function(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) { + summary_quantile(x = x, na.rm = na.rm, na_type = na_type, weights = weights, probs = 0.67, na_max_prop = na_max_prop, ...) +} + +#' Calculate 70th Percentile +#' +#' Computes the 70th percentile of a dataset using `summary_quantile`. +#' +#' @inheritParams summary_quantile +#' @return The 70th percentile of the dataset. +#' @export +p70 <- function(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) { + summary_quantile(x = x, na.rm = na.rm, na_type = na_type, weights = weights, probs = 0.7, na_max_prop = na_max_prop, ...) +} + +#' Calculate 75th Percentile (Third Quartile) +#' +#' Computes the 75th percentile of a dataset using `summary_quantile`. +#' +#' @inheritParams summary_quantile +#' @return The 75th percentile of the dataset. +#' @export +p75 <- function(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) { + summary_quantile(x = x, na.rm = na.rm, na_type = na_type, weights = weights, probs = 0.75, na_max_prop = na_max_prop, ...) +} + +#' Calculate 80th Percentile +#' +#' Computes the 80th percentile of a dataset using `summary_quantile`. +#' +#' @inheritParams summary_quantile +#' @return The 80th percentile of the dataset. +#' @export +p80 <- function(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) { + summary_quantile(x = x, na.rm = na.rm, na_type = na_type, weights = weights, probs = 0.8, na_max_prop = na_max_prop, ...) +} + +#' Calculate 90th Percentile +#' +#' Computes the 90th percentile of a dataset using `summary_quantile`. +#' +#' @inheritParams summary_quantile +#' @return The 90th percentile of the dataset. +#' @export +p90 <- function(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) { + summary_quantile(x = x, na.rm = na.rm, na_type = na_type, weights = weights, probs = 0.9, na_max_prop = na_max_prop, ...) +} + +#' Calculate Skewness +#' +#' Computes the skewness or weighted skewness of a dataset. +#' +#' @param x A numeric vector. +#' @param weights Optional weights for the data. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param type Integer. Type of skewness calculation. Defaults to `2`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The skewness or weighted skewness of the dataset. +#' @export +summary_skewness <- function(x, weights = NULL, na.rm = FALSE, type = 2, na_type = "", ...) { + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if (missing(weights) || is.null(weights)) { + return(e1071::skewness(x, na.rm = na.rm, type = type)) + } + if (length(weights) != length(x)) stop("'x' and 'weights' must have the same length") + if (na.rm) { + i <- !is.na(x) && !is.na(weights) + weights <- weights[i] + x <- x[i] + } + ( sum( weights * (x - Weighted.Desc.Stat::w.mean(x, weights))^3 ) / sum(weights)) / Weighted.Desc.Stat::w.sd(x, weights)^3 + } +} + +#' Calculate Medcouple Skewness +#' +#' Computes the medcouple skewness using `robustbase::mc`. +#' +#' @param x A numeric vector. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The medcouple skewness. +#' @export +summary_skewness_mc <- function(x, na.rm = FALSE, na_type = "", ...) { + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + return(robustbase::mc(x, na.rm = na.rm)) + } +} + +#' Calculate Outlier Limits +#' +#' Computes the upper or lower outlier limits based on skewness and interquartile range. +#' +#' @param x A numeric vector. +#' @param coef Numeric. Coefficient for the IQR. Defaults to `1.5`. +#' @param bupperlimit Logical. Calculate upper limit if `TRUE`, lower limit otherwise. Defaults to `TRUE`. +#' @param bskewedcalc Logical. Use skewness in the calculation if `TRUE`. Defaults to `FALSE`. +#' @param skewnessweight Numeric. Weight for skewness in the calculation. Defaults to `4`. +#' @param na.rm Logical. Should missing values be removed? Defaults to `TRUE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param omit Logical. Omit values below a threshold. Defaults to `FALSE`. +#' @param value Numeric. Threshold for omission. Defaults to `0`. +#' @param ... Additional arguments passed to `na_check`. +#' @return The calculated outlier limit. +#' @export +summary_outlier_limit <- function(x, coef = 1.5, bupperlimit = TRUE, bskewedcalc = FALSE, skewnessweight = 4, na.rm = TRUE, na_type = "", omit = FALSE, value = 0, ...){ + if(omit){ + #This is needed when we need rainy days defined(Rain>=0.85) + #if(value!=0){ + # x <- x[x>=value] + #}else{ + x <- x[x>value] + #} + } + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + quart <- quantile(x, na.rm = na.rm) + Q1 <- quart[[2]] + Q3 <- quart[[4]] + IQR <- Q3 - Q1 + MC <- 0 + if(bskewedcalc){ + MC <- robustbase::mc(x, na.rm = na.rm) + } + if(bupperlimit){ + Q3 + coef*exp(skewnessweight*MC)*IQR + } else { + Q1 - coef*exp(-skewnessweight*MC)*IQR + } + } +} + +#' Calculate Kurtosis +#' +#' Computes the kurtosis or weighted kurtosis of a dataset. +#' +#' @param x A numeric vector. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param weights Optional weights for the data. +#' @param type Integer. Type of kurtosis calculation. Defaults to `2`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The kurtosis or weighted kurtosis of the dataset. +#' @export +summary_kurtosis <- function(x, na.rm = FALSE, weights = NULL, type = 2, na_type = "", ...) { + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if (missing(weights) || is.null(weights)) { + return(e1071::kurtosis(x, na.rm = na.rm, type = type)) + } + if (length(weights) != length(x)) + stop("'x' and 'weights' must have the same length") + if (na.rm) { + i <- !is.na(x) && !is.na(weights) + weights <- weights[i] + x <- x[i] + } + ((sum(weights * (x - Weighted.Desc.Stat::w.mean(x, weights))^4)/sum(weights))/Weighted.Desc.Stat::w.sd(x, weights)^4) - 3 + } +} + +#' Calculate Coefficient of Variation +#' +#' Computes the coefficient of variation for a dataset. +#' +#' @param x A numeric vector. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param weights Optional weights for the data. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The coefficient of variation. +#' @export +summary_coef_var <- function(x, na.rm = FALSE, weights = NULL, na_type = "", ...) { + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if (missing(weights) || is.null(weights)) { + return(summary_sd(x) / summary_mean(x)) + } + if (length(weights) != length(x)) + stop("'x' and 'weights' must have the same length") + if (na.rm) { + i <- !is.na(x) && !is.na(weights) + weights <- weights[i] + x <- x[i] + } + Weighted.Desc.Stat::w.cv(x = x, mu = weights) + } +} + +#' Calculate Median Absolute Deviation +#' +#' Computes the median absolute deviation or weighted absolute deviation. +#' +#' @param x A numeric vector. +#' @param constant Numeric. Scale factor. Defaults to `1.4826`. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param weights Optional weights for the data. +#' @param low Logical. Use only values below the median. Defaults to `FALSE`. +#' @param high Logical. Use only values above the median. Defaults to `FALSE`. +#' @param ... Additional arguments passed to `na_check`. +#' @return The median absolute deviation or weighted absolute deviation. +#' @export +summary_median_absolute_deviation <- function(x, constant = 1.4826, na.rm = FALSE, na_type = "", weights = NULL, low = FALSE, high = FALSE, ...) { + if (na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else { + if (missing(weights) || is.null(weights)) { + return(stats::mad(x, constant = constant, na.rm = na.rm, low = low, high = high)) + } + else { + Weighted.Desc.Stat::w.ad(x = x, mu = weights) + } + } +} + +#' Calculate Qn +#' +#' Computes the robust Qn scale estimator using `robustbase::Qn`. +#' +#' @param x A numeric vector. +#' @param constant Numeric. Scale factor. Defaults to `2.21914`. +#' @param finite.corr Logical. Apply finite sample correction. Defaults to `TRUE`. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The Qn scale estimator. +#' @export +summary_Qn <- function(x, constant = 2.21914, finite.corr = missing(constant), na.rm = FALSE, na_type = "", ...) { + if(!na.rm && anyNA(x)) return(NA) + else { + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + x <- x[!is.na(x)] + return(robustbase::Qn(x, constant = constant, finite.corr = finite.corr)) + } + } +} + +#' Calculate Sn +#' +#' Computes the robust Sn scale estimator using `robustbase::Sn`. +#' +#' @param x A numeric vector. +#' @param constant Numeric. Scale factor. Defaults to `1.1926`. +#' @param finite.corr Logical. Apply finite sample correction. Defaults to `TRUE`. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The Sn scale estimator. +#' @export +summary_Sn <- function(x, constant = 1.1926, finite.corr = missing(constant), na.rm = FALSE, na_type = "", ...) { + if(!na.rm && anyNA(x)) return(NA) + else { + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + x <- x[!is.na(x)] + return(robustbase::Qn(x, constant = constant, finite.corr = finite.corr)) + } + } +} + +#' Calculate Correlation +#' +#' Computes the correlation or weighted correlation between two datasets. +#' +#' @param x A numeric vector. +#' @param y A numeric vector. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param weights Optional weights for the data. +#' @param method Character. Correlation method ("pearson", "kendall", "spearman"). Defaults to `"pearson"`. +#' @param cor_use Character. How missing data is handled ("everything", "all.obs", etc.). Defaults to `"everything"`. +#' @param ... Additional arguments passed to `na_check`. +#' @return The correlation or weighted correlation. +#' @export +summary_cor <- function(x, y, na.rm = FALSE, na_type = "", weights = NULL, method = c("pearson", "kendall", "spearman"), cor_use = c("everything", "all.obs", "complete.obs", "na.or.complete", "pairwise.complete.obs"), ...) { + cor_use <- match.arg(cor_use) + if (na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else { + if (missing(weights) || is.null(weights)) { + return(cor(x = x, y = y, use = cor_use, method = method)) + } + else { + weights::wtd.cor(x = x, y = y, weight = weights)[1] + } + } +} + +#' Calculate Covariance +#' +#' Computes the covariance or weighted covariance between two datasets. +#' +#' @param x A numeric vector. +#' @param y A numeric vector. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param weights Optional weights for the data. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param method Character. Covariance method ("pearson", "kendall", "spearman"). Defaults to `"pearson"`. +#' @param use Character. How missing data is handled ("everything", "all.obs", etc.). Defaults to `"everything"`. +#' @param ... Additional arguments passed to `na_check`. +#' @return The covariance or weighted covariance. +#' @export +summary_cov <- function(x, y, na.rm = FALSE, weights = NULL, na_type = "", method = c("pearson", "kendall", "spearman"), use = c( "everything", "all.obs", "complete.obs", "na.or.complete", "pairwise.complete.obs"), ...) { + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if (missing(weights) || is.null(weights)) { + return(cov(x = x, y = y, use = use, method = method)) + } + if (length(weights) != length(x)) + stop("'x' and 'weights' must have the same length") + if (na.rm) { + i <- !is.na(x) && !is.na(weights) + weights <- weights[i] + x <- x[i] + } + (sum(weights * x * y)/sum(weights)) - (Weighted.Desc.Stat::w.mean(x = x, mu = weights) * Weighted.Desc.Stat::w.mean(x = y, mu = weights)) + } +} + +#' Get First Element +#' +#' Returns the first element of a vector, optionally ordered by another vector. +#' +#' @param x A vector. +#' @param order_by Optional vector to order by. +#' @param ... Additional arguments (not used). +#' @return The first element of the vector. +#' @export +summary_first <- function(x, order_by = NULL, ...) { + return(dplyr::first(x = x, order_by = order_by)) +} + +#' Get Last Element +#' +#' Returns the last element of a vector, optionally ordered by another vector. +#' +#' @param x A vector. + + +#' Get Last Element +#' +#' Returns the last element of a vector, optionally ordered by another vector. +#' +#' @param x A vector. +#' @param order_by Optional. A vector to order by before selecting the last element. +#' @param ... Additional arguments (not used). +#' @return The last element of the vector. +#' @export +summary_last <- function(x, order_by = NULL, ...) { + ... +} + +#' Get nth Element +#' +#' Returns the nth element of a vector, optionally ordered by another vector. +#' +#' @param x A vector. +#' @param nth_value Integer. The position of the element to return. +#' @param order_by Optional. A vector to order by before selecting the nth element. +#' @param ... Additional arguments (not used). +#' @return The nth element of the vector. +#' @export +summary_nth <- function(x, nth_value, order_by = NULL, ...) { + ... +} + +#' Get Last Element +#' +#' Returns the last element of a vector, optionally ordered by another vector. +#' +#' @param x A vector. +#' @param order_by Optional. A vector to order by before selecting the last element. +#' @param ... Additional arguments (not used). +#' @return The last element of the vector. +#' @export +summary_last <- function(x, order_by = NULL, ...) { + return(dplyr::last(x = x, order_by = order_by)) +} + +#' Get nth Element +#' +#' Returns the nth element of a vector, optionally ordered by another vector. +#' +#' @param x A vector. +#' @param nth_value Integer. The position of the element to return. +#' @param order_by Optional. A vector to order by before selecting the nth element. +#' @param ... Additional arguments (not used). +#' @return The nth element of the vector. +#' @export +summary_nth <- function(x, nth_value, order_by = NULL, ...) { + return(dplyr::nth(x = x, n = nth_value, order_by = order_by)) +} + +#' Count Distinct Elements +#' +#' Counts the number of distinct elements in a vector. +#' +#' @param x A vector of data. +#' @param na.rm Logical. Should missing values (`NA`) be removed? Defaults to `FALSE`. +#' @param ... Additional arguments (not used). +#' @return The count of distinct elements in the vector. +#' @export +summary_n_distinct<- function(x, na.rm = FALSE, ...) { + return(dplyr::n_distinct(x, na.rm = na.rm)) +} + +#' Sample a Single Element +#' +#' Randomly samples a single element from a vector. +#' +#' @param x A vector of data. +#' @param replace Logical. Should sampling be with replacement? Defaults to `FALSE`. +#' @param seed Optional. A seed for reproducibility. +#' @param ... Additional arguments (not used). +#' @return A randomly sampled element from the vector. +#' @export +summary_sample <- function(x, replace = FALSE, seed, ...){ + if(!missing(seed)) set.seed(seed = seed) + return(sample(x = x, size = 1, replace = replace)) +} + +#' Calculate Proportion +#' +#' Calculates the proportion of elements in a dataset that satisfy a specified condition. +#' +#' @param x A numeric vector. +#' @param prop_test Character. The comparison operator (e.g., `"=="`, `">="`). +#' @param prop_value Numeric. The value to compare against. +#' @param As_percentage Logical. Return the result as a percentage if `TRUE`. Defaults to `FALSE`. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The calculated proportion or percentage. +#' @export +proportion_calc <- function(x, prop_test = "==", prop_value, As_percentage = FALSE, na.rm = FALSE, na_type = "", ... ){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(!na.rm){ + if(sum(is.na(x)) > 0) return(NA) + y <- x[eval(parse(text = paste("x", prop_value, sep = prop_test)))] + if(!As_percentage){ + return(round(length(y)/length(x),digits = 2)) + } + else { + return(round((length(y)/length(x)*100),digits = 2 )) + } + } + else { + remove.na <- na.omit(x) + y <- remove.na[eval(parse(text = paste("remove.na", prop_value, sep = prop_test)))] + if (!As_percentage){ + return(round(length(y)/length(remove.na), digits = 2)) + } + else{ + return(round(length(y)/length(remove.na)*100, digits = 2 )) + } + } + } +} + +#' Count Matching Elements +#' +#' Counts the number of elements in a dataset that satisfy a specified condition. +#' +#' @param x A numeric vector. +#' @param count_test Character. The comparison operator (e.g., `"=="`, `">="`). +#' @param count_value Numeric. The value to compare against. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The count of matching elements. +#' @export +count_calc <- function(x, count_test = "==", count_value, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if (!na.rm){ + if (sum(is.na(x)) > 0) return(NA) + return(length(x[eval(parse(text = paste("x", count_value, sep = count_test)))])) + } + else{ + y <- na.omit(x) + return(length(y[eval(parse(text = paste("y", count_value, sep = count_test)))])) + } + } +} + +#' Calculate Standard Error of the Mean +#' +#' Computes the standard error of the mean for a dataset. +#' +#' @param x A numeric vector. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The standard error of the mean. +#' @export +standard_error_mean <- function(x, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if (!na.rm){ + if(sum(is.na(x) > 0)) return(NA) + return(sd(x)/sqrt(length(x))) + } + else{ + y <- na.omit(x) + return(sd(y)/sqrt(length(y))) + } + } +} + +#' Calculate Mean Error +#' +#' Computes the mean error using the `hydroGOF::me` function. +#' +#' @param x Observed values. +#' @param y Simulated values. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The mean error. +#' @export +me <- function(x, y, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(length(x[is.na(x)])==length(x)||length(y[is.na(y)])==length(y)) return(NA) + return(hydroGOF::me(sim = y, obs = x, na.rm = na.rm)) + } +} + +#' Calculate Mean Absolute Error +#' +#' Computes the mean absolute error using the `hydroGOF::mae` function. +#' +#' @inheritParams me +#' @return The mean absolute error. +#' @export +mae <- function(x, y, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(length(x[is.na(x)])==length(x)||length(y[is.na(y)])==length(y)) return(NA) + return(hydroGOF::mae(sim = y, obs = x, na.rm = na.rm)) + } +} + +#' Calculate Root Mean Square Error +#' +#' Computes the root mean square error using the `hydroGOF::rmse` function. +#' +#' @inheritParams me +#' @return The root mean square error. +#' @export +rmse <- function(x, y, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(length(x[is.na(x)])==length(x)||length(y[is.na(y)])==length(y)) return(NA) + return(hydroGOF::rmse(sim = y, obs = x, na.rm = na.rm)) + } +} + +#' Calculate Normalized Root Mean Square Error +#' +#' Computes the normalized root mean square error using the `hydroGOF::nrmse` function. +#' +#' @inheritParams me +#' @return The normalized root mean square error. +#' @export +nrmse <- function(x, y, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(length(x[is.na(x)])==length(x)||length(y[is.na(y)])==length(y)) return(NA) + return(hydroGOF::nrmse(sim = y, obs = x, na.rm = na.rm)) + } +} + +#' Calculate Percent Bias +#' +#' Computes the percent bias using the `hydroGOF::pbias` function. +#' +#' @inheritParams me +#' @return The percent bias. +#' @export +PBIAS <- function(x, y, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(length(x[is.na(x)])==length(x)||length(y[is.na(y)])==length(y)) return(NA) + return(hydroGOF::pbias(sim = y, obs = x, na.rm = na.rm)) + } +} + +#' Calculate Nash-Sutcliffe Efficiency +#' +#' Computes the Nash-Sutcliffe efficiency using the `hydroGOF::NSeff` function. +#' +#' @inheritParams me +#' @return The Nash-Sutcliffe efficiency. +#' @export +NSE <- function(x, y, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(length(x[is.na(x)])==length(x)||length(y[is.na(y)])==length(y)) return(NA) + return(hydroGOF::NSeff(sim = y, obs = x, na.rm = na.rm)) + } +} + +#' Calculate Modified Nash-Sutcliffe Efficiency +#' +#' Computes the modified Nash-Sutcliffe efficiency using the `hydroGOF::mNSE` function. +#' +#' @param j Numeric. Exponent parameter for the modified NSE calculation. Defaults to `1`. +#' @inheritParams me +#' @return The modified Nash-Sutcliffe efficiency. +#' @export +mNSE <- function(x, y, j = 1, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(length(x[is.na(x)])==length(x)||length(y[is.na(y)])==length(y)) return(NA) + return(hydroGOF::mNSE(sim = y, obs = x, j = j, na.rm = na.rm)) + } +} + +#' Calculate Relative Nash-Sutcliffe Efficiency +#' +#' Computes the relative Nash-Sutcliffe efficiency using the `hydroGOF::rNSeff` function. +#' +#' @param x Observed values. +#' @param y Simulated values. +#' @param na.rm Logical. Should missing values be removed? Defaults to `FALSE`. +#' @param na_type Character string indicating the type of NA check to perform. +#' @param ... Additional arguments passed to `na_check`. +#' @return The relative Nash-Sutcliffe efficiency. +#' @export +rNSE <- function(x, y, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(length(x[is.na(x)])==length(x)||length(y[is.na(y)])==length(y)) return(NA) + return(hydroGOF::rNSeff(sim = y, obs = x, na.rm = na.rm)) + } +} + +#' Calculate Index of Agreement +#' +#' Computes the index of agreement using the `hydroGOF::d` function. +#' +#' @inheritParams rNSE +#' @return The index of agreement. +#' @export +d <- function(x, y, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(length(x[is.na(x)])==length(x)||length(y[is.na(y)])==length(y)) return(NA) + return(hydroGOF::d(sim = y, obs = x, na.rm = na.rm)) + } +} + +#' Calculate Modified Index of Agreement +#' +#' Computes the modified index of agreement using the `hydroGOF::md` function. +#' +#' @param j Numeric. Parameter for the modified index of agreement. Defaults to `1`. +#' @inheritParams rNSE +#' @return The modified index of agreement. +#' @export +md <- function(x, y, j = 1, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(length(x[is.na(x)])==length(x)||length(y[is.na(y)])==length(y)) return(NA) + return(hydroGOF::md(sim = y, obs = x, j = j, na.rm = na.rm)) + } +} + +#' Calculate Relative Index of Agreement +#' +#' Computes the relative index of agreement using the `hydroGOF::rd` function. +#' +#' @inheritParams rNSE +#' @return The relative index of agreement. +#' @export +rd <- function(x, y, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(length(x[is.na(x)])==length(x)||length(y[is.na(y)])==length(y)) return(NA) + return(hydroGOF::rd(sim = y, obs = x, na.rm = na.rm)) + } +} + +#' Calculate Coefficient of Determination (R²) +#' +#' Computes the coefficient of determination using the `hydroGOF::br2` function. +#' +#' @inheritParams rNSE +#' @return The coefficient of determination (R²). +#' @export +R2 <- function(x, y, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(length(x[is.na(x)])==length(x)||length(y[is.na(y)])==length(y)) return(NA) + return(hydroGOF::br2(sim = y, obs = x, na.rm = na.rm)) + } +} + +#' Calculate Coefficient of Persistence +#' +#' Computes the coefficient of persistence using the `hydroGOF::cp` function. +#' +#' @inheritParams rNSE +#' @return The coefficient of persistence. +#' @export +cp <- function(x, y, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(length(unique(y))==1||length(x[is.na(x)])==length(x)||length(y[is.na(y)])==length(y)) return(NA) + return(hydroGOF::cp(sim = y, obs = x, na.rm = na.rm)) + } +} + +#' Calculate Kling-Gupta Efficiency +#' +#' Computes the Kling-Gupta efficiency using the `hydroGOF::KGE` function. +#' +#' @inheritParams rNSE +#' @return The Kling-Gupta efficiency. +#' @export +KGE <- function(x, y, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(length(x[is.na(x)])==length(x)||length(y[is.na(y)])==length(y)) return(NA) + return(hydroGOF::KGE(sim = y, obs = x, na.rm = na.rm)) + } +} + +#' Calculate Mean Squared Error +#' +#' Computes the mean squared error using the `hydroGOF::mse` function. +#' +#' @inheritParams rNSE +#' @return The mean squared error. +#' @export +mse <- function(x, y, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(length(x[is.na(x)])==length(x)||length(y[is.na(y)])==length(y)) return(NA) + return(hydroGOF::mse(sim = y, obs = x, na.rm = na.rm)) + } +} + +#' Calculate Ratio of Standard Deviations +#' +#' Computes the ratio of standard deviations using the `hydroGOF::rSD` function. +#' +#' @inheritParams rNSE +#' @return The ratio of standard deviations. +#' @export +rSD <- function(x, y, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(length(x[is.na(x)])==length(x)||length(y[is.na(y)])==length(y)) return(NA) + return(hydroGOF::rSD(sim = y, obs = x, na.rm = na.rm)) + } +} + +#' Calculate Ratio of RMSE +#' +#' Computes the ratio of RMSE using the `hydroGOF::rsr` function. +#' +#' @inheritParams rNSE +#' @return The ratio of RMSE. +#' @export +rsr <- function(x, y, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(length(x[is.na(x)])==length(x)||length(y[is.na(y)])==length(y)) return(NA) + return(hydroGOF::rsr(sim = y, obs = x, na.rm = na.rm)) + } +} + + +#' Calculate Sum of Squared Residuals +#' +#' Computes the sum of squared residuals using the `hydroGOF::ssq` function. +#' +#' @inheritParams rNSE +#' @return The sum of squared residuals. +#' @export +ssq <- function(x, y, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(length(x[is.na(x)])==length(x)||length(y[is.na(y)])==length(y)) return(NA) + return(hydroGOF::ssq(sim = y, obs = x, na.rm = na.rm)) + } +} + +#' Calculate Volumetric Efficiency +#' +#' Computes the volumetric efficiency using the `hydroGOF::VE` function. +#' +#' @inheritParams rNSE +#' @return The volumetric efficiency. +#' @export +VE <- function(x, y, na.rm = FALSE, na_type = "", ...){ + if(na.rm && na_type != "" && !na_check(x, na_type = na_type, ...)) return(NA) + else{ + if(length(x[is.na(x)])==length(x)||length(y[is.na(y)])==length(y)) return(NA) + return(hydroGOF::VE(sim = y, obs = x, na.rm = na.rm)) + } +} + +#' Calculate Percent Correct +#' +#' Computes the percent correct using the `verification::verify` function. +#' +#' @param x Observed values. +#' @param y Predicted values. +#' @param frcst.type Character. The type of forecast (e.g., "binary"). +#' @param obs.type Character. The type of observation (e.g., "binary"). +#' @param ... Additional arguments passed to `verification::verify`. +#' @return The percent correct. +#' @export +pc <- function(x, y, frcst.type, obs.type, ...){ + A <- verification::verify(obs = x, pred = y, frcst.type = frcst.type, obs.type = obs.type) + return(A$pc) +} + +#' Calculate Heidke Skill Score +#' +#' Computes the Heidke skill score using the `verification::verify` function. +#' +#' @inheritParams pc +#' @return The Heidke skill score. +#' @export +hss <- function(x, y, frcst.type, obs.type, ...){ + A <- verification::verify(obs = x, pred = y, frcst.type = frcst.type, obs.type = obs.type) + return(A$hss) +} + +#' Calculate Pierce Skill Score +#' +#' Computes the Pierce skill score using the `verification::verify` function. +#' +#' @inheritParams pc +#' @return The Pierce skill score. +#' @export +pss <- function(x, y, frcst.type, obs.type, ...){ + A <- verification::verify(obs = x, pred = y, frcst.type = frcst.type, obs.type = obs.type) + return(A$pss) +} + +#' Calculate Gerrity Score +#' +#' Computes the Gerrity score using the `verification::verify` function. +#' +#' @inheritParams pc +#' @return The Gerrity score. +#' @export +GS <- function(x, y, frcst.type, obs.type, ...){ + A <- verification::verify(obs = x, pred = y, frcst.type = frcst.type, obs.type = obs.type) + return(A$gs) +} + +#' Calculate Probability of Detection (PODy) +#' +#' Computes the probability of detection (PODy) using the `verification::verify` function. +#' +#' @inheritParams pc +#' @return The probability of detection. +#' @export +PODy <- function(x, y, frcst.type, obs.type, ...){ + A <- verification::verify(obs = x, pred = y, frcst.type = frcst.type, obs.type = obs.type) + return(A$POD) +} + +#' Calculate Threat Score +#' +#' Computes the threat score using the `verification::verify` function. +#' +#' @inheritParams pc +#' @return The threat score. +#' @export +TS <- function(x, y, frcst.type, obs.type, ...){ + A <- verification::verify(obs = x, pred = y, frcst.type = frcst.type, obs.type = obs.type) + return(A$TS) +} + +#' Calculate Equitable Threat Score +#' +#' Computes the equitable threat score using the `verification::verify` function. +#' +#' @inheritParams pc +#' @return The equitable threat score. +#' @export +ETS <- function(x, y, frcst.type, obs.type, ...){ + A <- verification::verify(obs = x, pred = y, frcst.type = frcst.type, obs.type = obs.type) + return(A$ETS) +} + +#' Calculate False Alarm Ratio +#' +#' Computes the false alarm ratio using the `verification::verify` function. +#' +#' @inheritParams pc +#' @return The false alarm ratio. +#' @export +FAR <- function(x, y, frcst.type, obs.type, ...){ + A <- verification::verify(obs = x, pred = y, frcst.type = frcst.type, obs.type = obs.type) + return(A$FAR) +} + +#' Calculate Heidke Skill Score (HSS) +#' +#' Computes the Heidke skill score using the `verification::verify` function. +#' +#' @inheritParams pc +#' @return The Heidke skill score. +#' @export +HSS <- function(x, y, frcst.type, obs.type, ...){ + A <- verification::verify(obs = x, pred = y, frcst.type = frcst.type, obs.type = obs.type) + return(A$HSS) +} + +#' Calculate Percent Correct (PC) +#' +#' Computes the percent correct using the `verification::verify` function. +#' +#' @inheritParams pc +#' @return The percent correct. +#' @export +PC <- function(x, y, frcst.type, obs.type, ...){ + A <- verification::verify(obs = x, pred = y, frcst.type = frcst.type, obs.type = obs.type) + return(A$PC) +} + +#' Calculate Bias +#' +#' Computes the bias using the `verification::verify` function. +#' +#' @inheritParams pc +#' @return The bias. +#' @export +BIAS <- function(x, y, frcst.type, obs.type, ...){ + A <- verification::verify(obs = x, pred = y, frcst.type = frcst.type, obs.type = obs.type) + return(A$BIAS) +} + + + + +#' Calculate Extreme Dependency Score +#' +#' Computes the extreme dependency score (EDS) using the `verification::verify` function. +#' +#' @param x Observed values. +#' @param y Predicted values. +#' @param frcst.type Character. The type of forecast (e.g., "categorical"). +#' @param obs.type Character. The type of observation (e.g., "categorical"). +#' @param ... Additional arguments passed to `verification::verify`. +#' @return The extreme dependency score. +#' @export +EDS <- function(x, y, frcst.type, obs.type, ...){ + A <- verification::verify(obs = x, pred = y, frcst.type = frcst.type, obs.type = obs.type) + return(A$eds) +} + +#' Calculate Symmetric Extreme Dependency Score +#' +#' Computes the symmetric extreme dependency score (SEDS) using the `verification::verify` function. +#' +#' @inheritParams EDS +#' @return The symmetric extreme dependency score. +#' @export +SEDS <- function(x, y, frcst.type, obs.type, ...){ + A <- verification::verify(obs = x, pred = y, frcst.type = frcst.type, obs.type = obs.type) + return(A$seds) +} + +#' Calculate Extremal Dependency Index +#' +#' Computes the extremal dependency index (EDI) using the `verification::verify` function. +#' +#' @inheritParams EDS +#' @return The extremal dependency index. +#' @export +EDI <- function(x, y, frcst.type, obs.type, ...){ + A <- verification::verify(obs = x, pred = y, frcst.type = frcst.type, obs.type = obs.type) + return(A$EDI) +} + +#' Calculate Symmetric Extremal Dependency Index +#' +#' Computes the symmetric extremal dependency index (SEDI) using the `verification::verify` function. +#' +#' @inheritParams EDS +#' @return The symmetric extremal dependency index. +#' @export +SEDI <- function(x, y, frcst.type, obs.type, ...){ + A <- verification::verify(obs = x, pred = y, frcst.type = frcst.type, obs.type = obs.type) + return(A$SEDI) +} \ No newline at end of file diff --git a/man/BIAS.Rd b/man/BIAS.Rd new file mode 100644 index 0000000..69ef670 --- /dev/null +++ b/man/BIAS.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{BIAS} +\alias{BIAS} +\title{Calculate Bias} +\usage{ +BIAS(x, y, frcst.type, obs.type, ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Predicted values.} + +\item{frcst.type}{Character. The type of forecast (e.g., "binary").} + +\item{obs.type}{Character. The type of observation (e.g., "binary").} + +\item{...}{Additional arguments passed to \code{verification::verify}.} +} +\value{ +The bias. +} +\description{ +Computes the bias using the \code{verification::verify} function. +} diff --git a/man/EDI.Rd b/man/EDI.Rd new file mode 100644 index 0000000..040b892 --- /dev/null +++ b/man/EDI.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{EDI} +\alias{EDI} +\title{Calculate Extremal Dependency Index} +\usage{ +EDI(x, y, frcst.type, obs.type, ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Predicted values.} + +\item{frcst.type}{Character. The type of forecast (e.g., "categorical").} + +\item{obs.type}{Character. The type of observation (e.g., "categorical").} + +\item{...}{Additional arguments passed to \code{verification::verify}.} +} +\value{ +The extremal dependency index. +} +\description{ +Computes the extremal dependency index (EDI) using the \code{verification::verify} function. +} diff --git a/man/p10.Rd b/man/p10.Rd new file mode 100644 index 0000000..e5aadfd --- /dev/null +++ b/man/p10.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{p10} +\alias{p10} +\title{Calculate 10th Percentile} +\usage{ +p10(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) +} +\arguments{ +\item{x}{A numeric vector, ordered factor, or date.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{weights}{Optional weights for the data.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The 10th percentile of the dataset. +} +\description{ +Computes the 10th percentile of a dataset using \code{summary_quantile}. +} diff --git a/man/summary_mean_circular.Rd b/man/summary_mean_circular.Rd new file mode 100644 index 0000000..453433f --- /dev/null +++ b/man/summary_mean_circular.Rd @@ -0,0 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_mean_circular} +\alias{summary_mean_circular} +\title{Calculate the Mean of Circular Data} +\usage{ +summary_mean_circular( + x, + na.rm = FALSE, + control.circular = list(), + na_type = "", + ... +) +} +\arguments{ +\item{x}{A vector of circular data.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{control.circular}{List of control parameters for circular objects.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The mean of the circular data. +} +\description{ +Computes the mean of circular data using \code{circular::mean.circular}. +} From a976b3b5068f28d7ae516ca58d86912176d8ba40 Mon Sep 17 00:00:00 2001 From: lilyclements Date: Wed, 20 Nov 2024 14:00:43 +0000 Subject: [PATCH 2/3] update manuals --- man/EDS.Rd | 25 ++++++++++++++++++++ man/ETS.Rd | 25 ++++++++++++++++++++ man/FAR.Rd | 25 ++++++++++++++++++++ man/GS.Rd | 25 ++++++++++++++++++++ man/KGE.Rd | 25 ++++++++++++++++++++ man/NSE.Rd | 25 ++++++++++++++++++++ man/PBIAS.Rd | 25 ++++++++++++++++++++ man/PODy.Rd | 25 ++++++++++++++++++++ man/R2.Rd | 25 ++++++++++++++++++++ man/SEDI.Rd | 25 ++++++++++++++++++++ man/SEDS.Rd | 25 ++++++++++++++++++++ man/TS.Rd | 25 ++++++++++++++++++++ man/VE.Rd | 25 ++++++++++++++++++++ man/count_calc.Rd | 27 ++++++++++++++++++++++ man/cp.Rd | 25 ++++++++++++++++++++ man/d.Rd | 25 ++++++++++++++++++++ man/hss.Rd | 25 ++++++++++++++++++++ man/mNSE.Rd | 27 ++++++++++++++++++++++ man/mae.Rd | 25 ++++++++++++++++++++ man/md.Rd | 27 ++++++++++++++++++++++ man/me.Rd | 25 ++++++++++++++++++++ man/mse.Rd | 25 ++++++++++++++++++++ man/nrmse.Rd | 25 ++++++++++++++++++++ man/p20.Rd | 25 ++++++++++++++++++++ man/p25.Rd | 25 ++++++++++++++++++++ man/p30.Rd | 25 ++++++++++++++++++++ man/p33.Rd | 25 ++++++++++++++++++++ man/p40.Rd | 25 ++++++++++++++++++++ man/p60.Rd | 25 ++++++++++++++++++++ man/p67.Rd | 25 ++++++++++++++++++++ man/p70.Rd | 25 ++++++++++++++++++++ man/p75.Rd | 25 ++++++++++++++++++++ man/p80.Rd | 25 ++++++++++++++++++++ man/p90.Rd | 25 ++++++++++++++++++++ man/pc.Rd | 25 ++++++++++++++++++++ man/proportion_calc.Rd | 37 +++++++++++++++++++++++++++++ man/pss.Rd | 25 ++++++++++++++++++++ man/rNSE.Rd | 25 ++++++++++++++++++++ man/rSD.Rd | 25 ++++++++++++++++++++ man/rd.Rd | 25 ++++++++++++++++++++ man/rmse.Rd | 25 ++++++++++++++++++++ man/rsr.Rd | 25 ++++++++++++++++++++ man/ssq.Rd | 25 ++++++++++++++++++++ man/standard_error_mean.Rd | 23 ++++++++++++++++++ man/summary_Q1_circular.Rd | 34 +++++++++++++++++++++++++++ man/summary_Q3_circular.Rd | 34 +++++++++++++++++++++++++++ man/summary_Qn.Rd | 34 +++++++++++++++++++++++++++ man/summary_Sn.Rd | 34 +++++++++++++++++++++++++++ man/summary_ang_dev_circular.Rd | 23 ++++++++++++++++++ man/summary_ang_var_circular.Rd | 23 ++++++++++++++++++ man/summary_coef_var.Rd | 25 ++++++++++++++++++++ man/summary_cor.Rd | 41 +++++++++++++++++++++++++++++++++ 52 files changed, 1364 insertions(+) create mode 100644 man/EDS.Rd create mode 100644 man/ETS.Rd create mode 100644 man/FAR.Rd create mode 100644 man/GS.Rd create mode 100644 man/KGE.Rd create mode 100644 man/NSE.Rd create mode 100644 man/PBIAS.Rd create mode 100644 man/PODy.Rd create mode 100644 man/R2.Rd create mode 100644 man/SEDI.Rd create mode 100644 man/SEDS.Rd create mode 100644 man/TS.Rd create mode 100644 man/VE.Rd create mode 100644 man/count_calc.Rd create mode 100644 man/cp.Rd create mode 100644 man/d.Rd create mode 100644 man/hss.Rd create mode 100644 man/mNSE.Rd create mode 100644 man/mae.Rd create mode 100644 man/md.Rd create mode 100644 man/me.Rd create mode 100644 man/mse.Rd create mode 100644 man/nrmse.Rd create mode 100644 man/p20.Rd create mode 100644 man/p25.Rd create mode 100644 man/p30.Rd create mode 100644 man/p33.Rd create mode 100644 man/p40.Rd create mode 100644 man/p60.Rd create mode 100644 man/p67.Rd create mode 100644 man/p70.Rd create mode 100644 man/p75.Rd create mode 100644 man/p80.Rd create mode 100644 man/p90.Rd create mode 100644 man/pc.Rd create mode 100644 man/proportion_calc.Rd create mode 100644 man/pss.Rd create mode 100644 man/rNSE.Rd create mode 100644 man/rSD.Rd create mode 100644 man/rd.Rd create mode 100644 man/rmse.Rd create mode 100644 man/rsr.Rd create mode 100644 man/ssq.Rd create mode 100644 man/standard_error_mean.Rd create mode 100644 man/summary_Q1_circular.Rd create mode 100644 man/summary_Q3_circular.Rd create mode 100644 man/summary_Qn.Rd create mode 100644 man/summary_Sn.Rd create mode 100644 man/summary_ang_dev_circular.Rd create mode 100644 man/summary_ang_var_circular.Rd create mode 100644 man/summary_coef_var.Rd create mode 100644 man/summary_cor.Rd diff --git a/man/EDS.Rd b/man/EDS.Rd new file mode 100644 index 0000000..3cad9c1 --- /dev/null +++ b/man/EDS.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{EDS} +\alias{EDS} +\title{Calculate Extreme Dependency Score} +\usage{ +EDS(x, y, frcst.type, obs.type, ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Predicted values.} + +\item{frcst.type}{Character. The type of forecast (e.g., "categorical").} + +\item{obs.type}{Character. The type of observation (e.g., "categorical").} + +\item{...}{Additional arguments passed to \code{verification::verify}.} +} +\value{ +The extreme dependency score. +} +\description{ +Computes the extreme dependency score (EDS) using the \code{verification::verify} function. +} diff --git a/man/ETS.Rd b/man/ETS.Rd new file mode 100644 index 0000000..4631cf6 --- /dev/null +++ b/man/ETS.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{ETS} +\alias{ETS} +\title{Calculate Equitable Threat Score} +\usage{ +ETS(x, y, frcst.type, obs.type, ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Predicted values.} + +\item{frcst.type}{Character. The type of forecast (e.g., "binary").} + +\item{obs.type}{Character. The type of observation (e.g., "binary").} + +\item{...}{Additional arguments passed to \code{verification::verify}.} +} +\value{ +The equitable threat score. +} +\description{ +Computes the equitable threat score using the \code{verification::verify} function. +} diff --git a/man/FAR.Rd b/man/FAR.Rd new file mode 100644 index 0000000..9303fa9 --- /dev/null +++ b/man/FAR.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{FAR} +\alias{FAR} +\title{Calculate False Alarm Ratio} +\usage{ +FAR(x, y, frcst.type, obs.type, ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Predicted values.} + +\item{frcst.type}{Character. The type of forecast (e.g., "binary").} + +\item{obs.type}{Character. The type of observation (e.g., "binary").} + +\item{...}{Additional arguments passed to \code{verification::verify}.} +} +\value{ +The false alarm ratio. +} +\description{ +Computes the false alarm ratio using the \code{verification::verify} function. +} diff --git a/man/GS.Rd b/man/GS.Rd new file mode 100644 index 0000000..8698814 --- /dev/null +++ b/man/GS.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{GS} +\alias{GS} +\title{Calculate Gerrity Score} +\usage{ +GS(x, y, frcst.type, obs.type, ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Predicted values.} + +\item{frcst.type}{Character. The type of forecast (e.g., "binary").} + +\item{obs.type}{Character. The type of observation (e.g., "binary").} + +\item{...}{Additional arguments passed to \code{verification::verify}.} +} +\value{ +The Gerrity score. +} +\description{ +Computes the Gerrity score using the \code{verification::verify} function. +} diff --git a/man/KGE.Rd b/man/KGE.Rd new file mode 100644 index 0000000..b6dbdfa --- /dev/null +++ b/man/KGE.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{KGE} +\alias{KGE} +\title{Calculate Kling-Gupta Efficiency} +\usage{ +KGE(x, y, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Simulated values.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The Kling-Gupta efficiency. +} +\description{ +Computes the Kling-Gupta efficiency using the \code{hydroGOF::KGE} function. +} diff --git a/man/NSE.Rd b/man/NSE.Rd new file mode 100644 index 0000000..898f045 --- /dev/null +++ b/man/NSE.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{NSE} +\alias{NSE} +\title{Calculate Nash-Sutcliffe Efficiency} +\usage{ +NSE(x, y, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Simulated values.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The Nash-Sutcliffe efficiency. +} +\description{ +Computes the Nash-Sutcliffe efficiency using the \code{hydroGOF::NSeff} function. +} diff --git a/man/PBIAS.Rd b/man/PBIAS.Rd new file mode 100644 index 0000000..9f0f88d --- /dev/null +++ b/man/PBIAS.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{PBIAS} +\alias{PBIAS} +\title{Calculate Percent Bias} +\usage{ +PBIAS(x, y, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Simulated values.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The percent bias. +} +\description{ +Computes the percent bias using the \code{hydroGOF::pbias} function. +} diff --git a/man/PODy.Rd b/man/PODy.Rd new file mode 100644 index 0000000..9e9cb0b --- /dev/null +++ b/man/PODy.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{PODy} +\alias{PODy} +\title{Calculate Probability of Detection (PODy)} +\usage{ +PODy(x, y, frcst.type, obs.type, ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Predicted values.} + +\item{frcst.type}{Character. The type of forecast (e.g., "binary").} + +\item{obs.type}{Character. The type of observation (e.g., "binary").} + +\item{...}{Additional arguments passed to \code{verification::verify}.} +} +\value{ +The probability of detection. +} +\description{ +Computes the probability of detection (PODy) using the \code{verification::verify} function. +} diff --git a/man/R2.Rd b/man/R2.Rd new file mode 100644 index 0000000..f46b42a --- /dev/null +++ b/man/R2.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{R2} +\alias{R2} +\title{Calculate Coefficient of Determination (R²)} +\usage{ +R2(x, y, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Simulated values.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The coefficient of determination (R²). +} +\description{ +Computes the coefficient of determination using the \code{hydroGOF::br2} function. +} diff --git a/man/SEDI.Rd b/man/SEDI.Rd new file mode 100644 index 0000000..d5e9233 --- /dev/null +++ b/man/SEDI.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{SEDI} +\alias{SEDI} +\title{Calculate Symmetric Extremal Dependency Index} +\usage{ +SEDI(x, y, frcst.type, obs.type, ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Predicted values.} + +\item{frcst.type}{Character. The type of forecast (e.g., "categorical").} + +\item{obs.type}{Character. The type of observation (e.g., "categorical").} + +\item{...}{Additional arguments passed to \code{verification::verify}.} +} +\value{ +The symmetric extremal dependency index. +} +\description{ +Computes the symmetric extremal dependency index (SEDI) using the \code{verification::verify} function. +} diff --git a/man/SEDS.Rd b/man/SEDS.Rd new file mode 100644 index 0000000..0e3fd93 --- /dev/null +++ b/man/SEDS.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{SEDS} +\alias{SEDS} +\title{Calculate Symmetric Extreme Dependency Score} +\usage{ +SEDS(x, y, frcst.type, obs.type, ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Predicted values.} + +\item{frcst.type}{Character. The type of forecast (e.g., "categorical").} + +\item{obs.type}{Character. The type of observation (e.g., "categorical").} + +\item{...}{Additional arguments passed to \code{verification::verify}.} +} +\value{ +The symmetric extreme dependency score. +} +\description{ +Computes the symmetric extreme dependency score (SEDS) using the \code{verification::verify} function. +} diff --git a/man/TS.Rd b/man/TS.Rd new file mode 100644 index 0000000..970b4a7 --- /dev/null +++ b/man/TS.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{TS} +\alias{TS} +\title{Calculate Threat Score} +\usage{ +TS(x, y, frcst.type, obs.type, ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Predicted values.} + +\item{frcst.type}{Character. The type of forecast (e.g., "binary").} + +\item{obs.type}{Character. The type of observation (e.g., "binary").} + +\item{...}{Additional arguments passed to \code{verification::verify}.} +} +\value{ +The threat score. +} +\description{ +Computes the threat score using the \code{verification::verify} function. +} diff --git a/man/VE.Rd b/man/VE.Rd new file mode 100644 index 0000000..571c4cd --- /dev/null +++ b/man/VE.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{VE} +\alias{VE} +\title{Calculate Volumetric Efficiency} +\usage{ +VE(x, y, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Simulated values.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The volumetric efficiency. +} +\description{ +Computes the volumetric efficiency using the \code{hydroGOF::VE} function. +} diff --git a/man/count_calc.Rd b/man/count_calc.Rd new file mode 100644 index 0000000..733a358 --- /dev/null +++ b/man/count_calc.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{count_calc} +\alias{count_calc} +\title{Count Matching Elements} +\usage{ +count_calc(x, count_test = "==", count_value, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{count_test}{Character. The comparison operator (e.g., \code{"=="}, \code{">="}).} + +\item{count_value}{Numeric. The value to compare against.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The count of matching elements. +} +\description{ +Counts the number of elements in a dataset that satisfy a specified condition. +} diff --git a/man/cp.Rd b/man/cp.Rd new file mode 100644 index 0000000..6e5ec93 --- /dev/null +++ b/man/cp.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{cp} +\alias{cp} +\title{Calculate Coefficient of Persistence} +\usage{ +cp(x, y, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Simulated values.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The coefficient of persistence. +} +\description{ +Computes the coefficient of persistence using the \code{hydroGOF::cp} function. +} diff --git a/man/d.Rd b/man/d.Rd new file mode 100644 index 0000000..dafb52e --- /dev/null +++ b/man/d.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{d} +\alias{d} +\title{Calculate Index of Agreement} +\usage{ +d(x, y, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Simulated values.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The index of agreement. +} +\description{ +Computes the index of agreement using the \code{hydroGOF::d} function. +} diff --git a/man/hss.Rd b/man/hss.Rd new file mode 100644 index 0000000..30caa85 --- /dev/null +++ b/man/hss.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{HSS} +\alias{HSS} +\title{Calculate Heidke Skill Score (HSS)} +\usage{ +HSS(x, y, frcst.type, obs.type, ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Predicted values.} + +\item{frcst.type}{Character. The type of forecast (e.g., "binary").} + +\item{obs.type}{Character. The type of observation (e.g., "binary").} + +\item{...}{Additional arguments passed to \code{verification::verify}.} +} +\value{ +The Heidke skill score. +} +\description{ +Computes the Heidke skill score using the \code{verification::verify} function. +} diff --git a/man/mNSE.Rd b/man/mNSE.Rd new file mode 100644 index 0000000..9b93d0b --- /dev/null +++ b/man/mNSE.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{mNSE} +\alias{mNSE} +\title{Calculate Modified Nash-Sutcliffe Efficiency} +\usage{ +mNSE(x, y, j = 1, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Simulated values.} + +\item{j}{Numeric. Exponent parameter for the modified NSE calculation. Defaults to \code{1}.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The modified Nash-Sutcliffe efficiency. +} +\description{ +Computes the modified Nash-Sutcliffe efficiency using the \code{hydroGOF::mNSE} function. +} diff --git a/man/mae.Rd b/man/mae.Rd new file mode 100644 index 0000000..661983f --- /dev/null +++ b/man/mae.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{mae} +\alias{mae} +\title{Calculate Mean Absolute Error} +\usage{ +mae(x, y, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Simulated values.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The mean absolute error. +} +\description{ +Computes the mean absolute error using the \code{hydroGOF::mae} function. +} diff --git a/man/md.Rd b/man/md.Rd new file mode 100644 index 0000000..e997778 --- /dev/null +++ b/man/md.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{md} +\alias{md} +\title{Calculate Modified Index of Agreement} +\usage{ +md(x, y, j = 1, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Simulated values.} + +\item{j}{Numeric. Parameter for the modified index of agreement. Defaults to \code{1}.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The modified index of agreement. +} +\description{ +Computes the modified index of agreement using the \code{hydroGOF::md} function. +} diff --git a/man/me.Rd b/man/me.Rd new file mode 100644 index 0000000..f5a0417 --- /dev/null +++ b/man/me.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{me} +\alias{me} +\title{Calculate Mean Error} +\usage{ +me(x, y, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Simulated values.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The mean error. +} +\description{ +Computes the mean error using the \code{hydroGOF::me} function. +} diff --git a/man/mse.Rd b/man/mse.Rd new file mode 100644 index 0000000..6d51999 --- /dev/null +++ b/man/mse.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{mse} +\alias{mse} +\title{Calculate Mean Squared Error} +\usage{ +mse(x, y, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Simulated values.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The mean squared error. +} +\description{ +Computes the mean squared error using the \code{hydroGOF::mse} function. +} diff --git a/man/nrmse.Rd b/man/nrmse.Rd new file mode 100644 index 0000000..9e83cad --- /dev/null +++ b/man/nrmse.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{nrmse} +\alias{nrmse} +\title{Calculate Normalized Root Mean Square Error} +\usage{ +nrmse(x, y, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Simulated values.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The normalized root mean square error. +} +\description{ +Computes the normalized root mean square error using the \code{hydroGOF::nrmse} function. +} diff --git a/man/p20.Rd b/man/p20.Rd new file mode 100644 index 0000000..4263bf9 --- /dev/null +++ b/man/p20.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{p20} +\alias{p20} +\title{Calculate 20th Percentile} +\usage{ +p20(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) +} +\arguments{ +\item{x}{A numeric vector, ordered factor, or date.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{weights}{Optional weights for the data.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The 20th percentile of the dataset. +} +\description{ +Computes the 20th percentile of a dataset using \code{summary_quantile}. +} diff --git a/man/p25.Rd b/man/p25.Rd new file mode 100644 index 0000000..cc05339 --- /dev/null +++ b/man/p25.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{p25} +\alias{p25} +\title{Calculate 25th Percentile (First Quartile)} +\usage{ +p25(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) +} +\arguments{ +\item{x}{A numeric vector, ordered factor, or date.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{weights}{Optional weights for the data.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The 25th percentile of the dataset. +} +\description{ +Computes the 25th percentile of a dataset using \code{summary_quantile}. +} diff --git a/man/p30.Rd b/man/p30.Rd new file mode 100644 index 0000000..5bc3847 --- /dev/null +++ b/man/p30.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{p30} +\alias{p30} +\title{Calculate 30th Percentile} +\usage{ +p30(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) +} +\arguments{ +\item{x}{A numeric vector, ordered factor, or date.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{weights}{Optional weights for the data.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The 30th percentile of the dataset. +} +\description{ +Computes the 30th percentile of a dataset using \code{summary_quantile}. +} diff --git a/man/p33.Rd b/man/p33.Rd new file mode 100644 index 0000000..cdd9641 --- /dev/null +++ b/man/p33.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{p33} +\alias{p33} +\title{Calculate 33rd Percentile} +\usage{ +p33(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) +} +\arguments{ +\item{x}{A numeric vector, ordered factor, or date.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{weights}{Optional weights for the data.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The 33rd percentile of the dataset. +} +\description{ +Computes the 33rd percentile of a dataset using \code{summary_quantile}. +} diff --git a/man/p40.Rd b/man/p40.Rd new file mode 100644 index 0000000..72bef5d --- /dev/null +++ b/man/p40.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{p40} +\alias{p40} +\title{Calculate 40th Percentile} +\usage{ +p40(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) +} +\arguments{ +\item{x}{A numeric vector, ordered factor, or date.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{weights}{Optional weights for the data.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The 40th percentile of the dataset. +} +\description{ +Computes the 40th percentile of a dataset using \code{summary_quantile}. +} diff --git a/man/p60.Rd b/man/p60.Rd new file mode 100644 index 0000000..c1dc968 --- /dev/null +++ b/man/p60.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{p60} +\alias{p60} +\title{Calculate 60th Percentile} +\usage{ +p60(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) +} +\arguments{ +\item{x}{A numeric vector, ordered factor, or date.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{weights}{Optional weights for the data.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The 60th percentile of the dataset. +} +\description{ +Computes the 60th percentile of a dataset using \code{summary_quantile}. +} diff --git a/man/p67.Rd b/man/p67.Rd new file mode 100644 index 0000000..dc205a7 --- /dev/null +++ b/man/p67.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{p67} +\alias{p67} +\title{Calculate 67th Percentile} +\usage{ +p67(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) +} +\arguments{ +\item{x}{A numeric vector, ordered factor, or date.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{weights}{Optional weights for the data.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The 67th percentile of the dataset. +} +\description{ +Computes the 67th percentile of a dataset using \code{summary_quantile}. +} diff --git a/man/p70.Rd b/man/p70.Rd new file mode 100644 index 0000000..826c94b --- /dev/null +++ b/man/p70.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{p70} +\alias{p70} +\title{Calculate 70th Percentile} +\usage{ +p70(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) +} +\arguments{ +\item{x}{A numeric vector, ordered factor, or date.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{weights}{Optional weights for the data.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The 70th percentile of the dataset. +} +\description{ +Computes the 70th percentile of a dataset using \code{summary_quantile}. +} diff --git a/man/p75.Rd b/man/p75.Rd new file mode 100644 index 0000000..2ea0eb9 --- /dev/null +++ b/man/p75.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{p75} +\alias{p75} +\title{Calculate 75th Percentile (Third Quartile)} +\usage{ +p75(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) +} +\arguments{ +\item{x}{A numeric vector, ordered factor, or date.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{weights}{Optional weights for the data.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The 75th percentile of the dataset. +} +\description{ +Computes the 75th percentile of a dataset using \code{summary_quantile}. +} diff --git a/man/p80.Rd b/man/p80.Rd new file mode 100644 index 0000000..38b4bdf --- /dev/null +++ b/man/p80.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{p80} +\alias{p80} +\title{Calculate 80th Percentile} +\usage{ +p80(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) +} +\arguments{ +\item{x}{A numeric vector, ordered factor, or date.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{weights}{Optional weights for the data.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The 80th percentile of the dataset. +} +\description{ +Computes the 80th percentile of a dataset using \code{summary_quantile}. +} diff --git a/man/p90.Rd b/man/p90.Rd new file mode 100644 index 0000000..42c2c4e --- /dev/null +++ b/man/p90.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{p90} +\alias{p90} +\title{Calculate 90th Percentile} +\usage{ +p90(x, na.rm = FALSE, na_type = "", weights = NULL, na_max_prop = NULL, ...) +} +\arguments{ +\item{x}{A numeric vector, ordered factor, or date.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{weights}{Optional weights for the data.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The 90th percentile of the dataset. +} +\description{ +Computes the 90th percentile of a dataset using \code{summary_quantile}. +} diff --git a/man/pc.Rd b/man/pc.Rd new file mode 100644 index 0000000..f426fac --- /dev/null +++ b/man/pc.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{PC} +\alias{PC} +\title{Calculate Percent Correct (PC)} +\usage{ +PC(x, y, frcst.type, obs.type, ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Predicted values.} + +\item{frcst.type}{Character. The type of forecast (e.g., "binary").} + +\item{obs.type}{Character. The type of observation (e.g., "binary").} + +\item{...}{Additional arguments passed to \code{verification::verify}.} +} +\value{ +The percent correct. +} +\description{ +Computes the percent correct using the \code{verification::verify} function. +} diff --git a/man/proportion_calc.Rd b/man/proportion_calc.Rd new file mode 100644 index 0000000..4a33b1d --- /dev/null +++ b/man/proportion_calc.Rd @@ -0,0 +1,37 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{proportion_calc} +\alias{proportion_calc} +\title{Calculate Proportion} +\usage{ +proportion_calc( + x, + prop_test = "==", + prop_value, + As_percentage = FALSE, + na.rm = FALSE, + na_type = "", + ... +) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{prop_test}{Character. The comparison operator (e.g., \code{"=="}, \code{">="}).} + +\item{prop_value}{Numeric. The value to compare against.} + +\item{As_percentage}{Logical. Return the result as a percentage if \code{TRUE}. Defaults to \code{FALSE}.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The calculated proportion or percentage. +} +\description{ +Calculates the proportion of elements in a dataset that satisfy a specified condition. +} diff --git a/man/pss.Rd b/man/pss.Rd new file mode 100644 index 0000000..ab9532a --- /dev/null +++ b/man/pss.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{pss} +\alias{pss} +\title{Calculate Pierce Skill Score} +\usage{ +pss(x, y, frcst.type, obs.type, ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Predicted values.} + +\item{frcst.type}{Character. The type of forecast (e.g., "binary").} + +\item{obs.type}{Character. The type of observation (e.g., "binary").} + +\item{...}{Additional arguments passed to \code{verification::verify}.} +} +\value{ +The Pierce skill score. +} +\description{ +Computes the Pierce skill score using the \code{verification::verify} function. +} diff --git a/man/rNSE.Rd b/man/rNSE.Rd new file mode 100644 index 0000000..04664e6 --- /dev/null +++ b/man/rNSE.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{rNSE} +\alias{rNSE} +\title{Calculate Relative Nash-Sutcliffe Efficiency} +\usage{ +rNSE(x, y, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Simulated values.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The relative Nash-Sutcliffe efficiency. +} +\description{ +Computes the relative Nash-Sutcliffe efficiency using the \code{hydroGOF::rNSeff} function. +} diff --git a/man/rSD.Rd b/man/rSD.Rd new file mode 100644 index 0000000..a510a8d --- /dev/null +++ b/man/rSD.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{rSD} +\alias{rSD} +\title{Calculate Ratio of Standard Deviations} +\usage{ +rSD(x, y, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Simulated values.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The ratio of standard deviations. +} +\description{ +Computes the ratio of standard deviations using the \code{hydroGOF::rSD} function. +} diff --git a/man/rd.Rd b/man/rd.Rd new file mode 100644 index 0000000..40c75c7 --- /dev/null +++ b/man/rd.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{rd} +\alias{rd} +\title{Calculate Relative Index of Agreement} +\usage{ +rd(x, y, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Simulated values.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The relative index of agreement. +} +\description{ +Computes the relative index of agreement using the \code{hydroGOF::rd} function. +} diff --git a/man/rmse.Rd b/man/rmse.Rd new file mode 100644 index 0000000..63780b3 --- /dev/null +++ b/man/rmse.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{rmse} +\alias{rmse} +\title{Calculate Root Mean Square Error} +\usage{ +rmse(x, y, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Simulated values.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The root mean square error. +} +\description{ +Computes the root mean square error using the \code{hydroGOF::rmse} function. +} diff --git a/man/rsr.Rd b/man/rsr.Rd new file mode 100644 index 0000000..10a6f7b --- /dev/null +++ b/man/rsr.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{rsr} +\alias{rsr} +\title{Calculate Ratio of RMSE} +\usage{ +rsr(x, y, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Simulated values.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The ratio of RMSE. +} +\description{ +Computes the ratio of RMSE using the \code{hydroGOF::rsr} function. +} diff --git a/man/ssq.Rd b/man/ssq.Rd new file mode 100644 index 0000000..89b3e25 --- /dev/null +++ b/man/ssq.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{ssq} +\alias{ssq} +\title{Calculate Sum of Squared Residuals} +\usage{ +ssq(x, y, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{Observed values.} + +\item{y}{Simulated values.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The sum of squared residuals. +} +\description{ +Computes the sum of squared residuals using the \code{hydroGOF::ssq} function. +} diff --git a/man/standard_error_mean.Rd b/man/standard_error_mean.Rd new file mode 100644 index 0000000..c265d1d --- /dev/null +++ b/man/standard_error_mean.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{standard_error_mean} +\alias{standard_error_mean} +\title{Calculate Standard Error of the Mean} +\usage{ +standard_error_mean(x, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The standard error of the mean. +} +\description{ +Computes the standard error of the mean for a dataset. +} diff --git a/man/summary_Q1_circular.Rd b/man/summary_Q1_circular.Rd new file mode 100644 index 0000000..1541dbc --- /dev/null +++ b/man/summary_Q1_circular.Rd @@ -0,0 +1,34 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_Q1_circular} +\alias{summary_Q1_circular} +\title{Calculate the First Quartile of Circular Data} +\usage{ +summary_Q1_circular( + x, + na.rm = FALSE, + names = FALSE, + type = 7, + na_type = "", + ... +) +} +\arguments{ +\item{x}{A vector of circular data.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{names}{Logical. Should the names of the quantiles be returned? Defaults to \code{FALSE}.} + +\item{type}{Integer. Type of quantile calculation.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The first quartile of the circular data. +} +\description{ +Computes the first quartile (Q1) of circular data using \code{circular::quantile.circular}. +} diff --git a/man/summary_Q3_circular.Rd b/man/summary_Q3_circular.Rd new file mode 100644 index 0000000..8730918 --- /dev/null +++ b/man/summary_Q3_circular.Rd @@ -0,0 +1,34 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_Q3_circular} +\alias{summary_Q3_circular} +\title{Calculate the Third Quartile of Circular Data} +\usage{ +summary_Q3_circular( + x, + na.rm = FALSE, + names = FALSE, + type = 7, + na_type = "", + ... +) +} +\arguments{ +\item{x}{A vector of circular data.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{names}{Logical. Should the names of the quantiles be returned? Defaults to \code{FALSE}.} + +\item{type}{Integer. Type of quantile calculation.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The third quartile of the circular data. +} +\description{ +Computes the third quartile (Q3) of circular data using \code{circular::quantile.circular}. +} diff --git a/man/summary_Qn.Rd b/man/summary_Qn.Rd new file mode 100644 index 0000000..f004df1 --- /dev/null +++ b/man/summary_Qn.Rd @@ -0,0 +1,34 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_Qn} +\alias{summary_Qn} +\title{Calculate Qn} +\usage{ +summary_Qn( + x, + constant = 2.21914, + finite.corr = missing(constant), + na.rm = FALSE, + na_type = "", + ... +) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{constant}{Numeric. Scale factor. Defaults to \code{2.21914}.} + +\item{finite.corr}{Logical. Apply finite sample correction. Defaults to \code{TRUE}.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The Qn scale estimator. +} +\description{ +Computes the robust Qn scale estimator using \code{robustbase::Qn}. +} diff --git a/man/summary_Sn.Rd b/man/summary_Sn.Rd new file mode 100644 index 0000000..9726ba4 --- /dev/null +++ b/man/summary_Sn.Rd @@ -0,0 +1,34 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_Sn} +\alias{summary_Sn} +\title{Calculate Sn} +\usage{ +summary_Sn( + x, + constant = 1.1926, + finite.corr = missing(constant), + na.rm = FALSE, + na_type = "", + ... +) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{constant}{Numeric. Scale factor. Defaults to \code{1.1926}.} + +\item{finite.corr}{Logical. Apply finite sample correction. Defaults to \code{TRUE}.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The Sn scale estimator. +} +\description{ +Computes the robust Sn scale estimator using \code{robustbase::Sn}. +} diff --git a/man/summary_ang_dev_circular.Rd b/man/summary_ang_dev_circular.Rd new file mode 100644 index 0000000..02cfeac --- /dev/null +++ b/man/summary_ang_dev_circular.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_ang_dev_circular} +\alias{summary_ang_dev_circular} +\title{Calculate Angular Deviation of Circular Data} +\usage{ +summary_ang_dev_circular(x, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{A vector of circular data.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The angular deviation of the circular data. +} +\description{ +Computes the angular deviation of circular data using \code{circular::angular.deviation}. +} diff --git a/man/summary_ang_var_circular.Rd b/man/summary_ang_var_circular.Rd new file mode 100644 index 0000000..15aca59 --- /dev/null +++ b/man/summary_ang_var_circular.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_ang_var_circular} +\alias{summary_ang_var_circular} +\title{Calculate Angular Variance of Circular Data} +\usage{ +summary_ang_var_circular(x, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{A vector of circular data.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The angular variance of the circular data. +} +\description{ +Computes the angular variance of circular data using \code{circular::angular.variance}. +} diff --git a/man/summary_coef_var.Rd b/man/summary_coef_var.Rd new file mode 100644 index 0000000..6fc545e --- /dev/null +++ b/man/summary_coef_var.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_coef_var} +\alias{summary_coef_var} +\title{Calculate Coefficient of Variation} +\usage{ +summary_coef_var(x, na.rm = FALSE, weights = NULL, na_type = "", ...) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{weights}{Optional weights for the data.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The coefficient of variation. +} +\description{ +Computes the coefficient of variation for a dataset. +} diff --git a/man/summary_cor.Rd b/man/summary_cor.Rd new file mode 100644 index 0000000..8acdf89 --- /dev/null +++ b/man/summary_cor.Rd @@ -0,0 +1,41 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_cor} +\alias{summary_cor} +\title{Calculate Correlation} +\usage{ +summary_cor( + x, + y, + na.rm = FALSE, + na_type = "", + weights = NULL, + method = c("pearson", "kendall", "spearman"), + cor_use = c("everything", "all.obs", "complete.obs", "na.or.complete", + "pairwise.complete.obs"), + ... +) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{y}{A numeric vector.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{weights}{Optional weights for the data.} + +\item{method}{Character. Correlation method ("pearson", "kendall", "spearman"). Defaults to \code{"pearson"}.} + +\item{cor_use}{Character. How missing data is handled ("everything", "all.obs", etc.). Defaults to \code{"everything"}.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The correlation or weighted correlation. +} +\description{ +Computes the correlation or weighted correlation between two datasets. +} From 9bd7934e81c1f3b0745fd647dec54f2c6e4ece8e Mon Sep 17 00:00:00 2001 From: lilyclements Date: Wed, 20 Nov 2024 14:01:11 +0000 Subject: [PATCH 3/3] update manuals --- man/summary_count.Rd | 19 ++++++++++ man/summary_count_missing.Rd | 19 ++++++++++ man/summary_count_non_missing.Rd | 19 ++++++++++ man/summary_cov.Rd | 41 +++++++++++++++++++++ man/summary_first.Rd | 21 +++++++++++ man/summary_kurtosis.Rd | 27 ++++++++++++++ man/summary_last.Rd | 27 ++++++++++++++ man/summary_max.Rd | 23 ++++++++++++ man/summary_max_circular.Rd | 34 ++++++++++++++++++ man/summary_mean.Rd | 37 +++++++++++++++++++ man/summary_median.Rd | 25 +++++++++++++ man/summary_medianHL_circular.Rd | 34 ++++++++++++++++++ man/summary_median_absolute_deviation.Rd | 40 +++++++++++++++++++++ man/summary_median_circular.Rd | 23 ++++++++++++ man/summary_min.Rd | 23 ++++++++++++ man/summary_min_circular.Rd | 34 ++++++++++++++++++ man/summary_n_distinct.Rd | 21 +++++++++++ man/summary_nth.Rd | 29 +++++++++++++++ man/summary_outlier_limit.Rd | 46 ++++++++++++++++++++++++ man/summary_quantile.Rd | 27 ++++++++++++++ man/summary_quantile_circular.Rd | 37 +++++++++++++++++++ man/summary_range.Rd | 23 ++++++++++++ man/summary_range_circular.Rd | 37 +++++++++++++++++++ man/summary_rho_circular.Rd | 23 ++++++++++++ man/summary_sample.Rd | 23 ++++++++++++ man/summary_sd.Rd | 25 +++++++++++++ man/summary_sd_circular.Rd | 23 ++++++++++++ man/summary_skewness.Rd | 27 ++++++++++++++ man/summary_skewness_mc.Rd | 23 ++++++++++++ man/summary_sum.Rd | 25 +++++++++++++ man/summary_trimmed_mean.Rd | 37 +++++++++++++++++++ man/summary_var.Rd | 25 +++++++++++++ man/summary_var_circular.Rd | 23 ++++++++++++ man/summary_where_max.Rd | 25 +++++++++++++ man/summary_where_min.Rd | 25 +++++++++++++ man/summary_which_max.Rd | 23 ++++++++++++ man/summary_which_min.Rd | 23 ++++++++++++ 37 files changed, 1016 insertions(+) create mode 100644 man/summary_count.Rd create mode 100644 man/summary_count_missing.Rd create mode 100644 man/summary_count_non_missing.Rd create mode 100644 man/summary_cov.Rd create mode 100644 man/summary_first.Rd create mode 100644 man/summary_kurtosis.Rd create mode 100644 man/summary_last.Rd create mode 100644 man/summary_max.Rd create mode 100644 man/summary_max_circular.Rd create mode 100644 man/summary_mean.Rd create mode 100644 man/summary_median.Rd create mode 100644 man/summary_medianHL_circular.Rd create mode 100644 man/summary_median_absolute_deviation.Rd create mode 100644 man/summary_median_circular.Rd create mode 100644 man/summary_min.Rd create mode 100644 man/summary_min_circular.Rd create mode 100644 man/summary_n_distinct.Rd create mode 100644 man/summary_nth.Rd create mode 100644 man/summary_outlier_limit.Rd create mode 100644 man/summary_quantile.Rd create mode 100644 man/summary_quantile_circular.Rd create mode 100644 man/summary_range.Rd create mode 100644 man/summary_range_circular.Rd create mode 100644 man/summary_rho_circular.Rd create mode 100644 man/summary_sample.Rd create mode 100644 man/summary_sd.Rd create mode 100644 man/summary_sd_circular.Rd create mode 100644 man/summary_skewness.Rd create mode 100644 man/summary_skewness_mc.Rd create mode 100644 man/summary_sum.Rd create mode 100644 man/summary_trimmed_mean.Rd create mode 100644 man/summary_var.Rd create mode 100644 man/summary_var_circular.Rd create mode 100644 man/summary_where_max.Rd create mode 100644 man/summary_where_min.Rd create mode 100644 man/summary_which_max.Rd create mode 100644 man/summary_which_min.Rd diff --git a/man/summary_count.Rd b/man/summary_count.Rd new file mode 100644 index 0000000..dc75d7b --- /dev/null +++ b/man/summary_count.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_count} +\alias{summary_count} +\title{Count Elements in a Dataset} +\usage{ +summary_count(x, ...) +} +\arguments{ +\item{x}{A vector of data.} + +\item{...}{Additional arguments (not used).} +} +\value{ +The count of elements in the dataset. +} +\description{ +Counts the number of elements in a dataset. +} diff --git a/man/summary_count_missing.Rd b/man/summary_count_missing.Rd new file mode 100644 index 0000000..5f16fcf --- /dev/null +++ b/man/summary_count_missing.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_count_missing} +\alias{summary_count_missing} +\title{Count Missing Elements in a Dataset} +\usage{ +summary_count_missing(x, ...) +} +\arguments{ +\item{x}{A vector of data.} + +\item{...}{Additional arguments (not used).} +} +\value{ +The count of missing elements in the dataset. +} +\description{ +Counts the number of missing (NA) elements in a dataset. +} diff --git a/man/summary_count_non_missing.Rd b/man/summary_count_non_missing.Rd new file mode 100644 index 0000000..33d8c37 --- /dev/null +++ b/man/summary_count_non_missing.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_count_non_missing} +\alias{summary_count_non_missing} +\title{Count Non-Missing Elements} +\usage{ +summary_count_non_missing(x, ...) +} +\arguments{ +\item{x}{A vector of data.} + +\item{...}{Additional arguments (not used).} +} +\value{ +The count of non-missing elements in the dataset. +} +\description{ +Counts the number of non-missing (non-NA) elements in a dataset. +} diff --git a/man/summary_cov.Rd b/man/summary_cov.Rd new file mode 100644 index 0000000..a3de83f --- /dev/null +++ b/man/summary_cov.Rd @@ -0,0 +1,41 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_cov} +\alias{summary_cov} +\title{Calculate Covariance} +\usage{ +summary_cov( + x, + y, + na.rm = FALSE, + weights = NULL, + na_type = "", + method = c("pearson", "kendall", "spearman"), + use = c("everything", "all.obs", "complete.obs", "na.or.complete", + "pairwise.complete.obs"), + ... +) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{y}{A numeric vector.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{weights}{Optional weights for the data.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{method}{Character. Covariance method ("pearson", "kendall", "spearman"). Defaults to \code{"pearson"}.} + +\item{use}{Character. How missing data is handled ("everything", "all.obs", etc.). Defaults to \code{"everything"}.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The covariance or weighted covariance. +} +\description{ +Computes the covariance or weighted covariance between two datasets. +} diff --git a/man/summary_first.Rd b/man/summary_first.Rd new file mode 100644 index 0000000..819e4b0 --- /dev/null +++ b/man/summary_first.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_first} +\alias{summary_first} +\title{Get First Element} +\usage{ +summary_first(x, order_by = NULL, ...) +} +\arguments{ +\item{x}{A vector.} + +\item{order_by}{Optional vector to order by.} + +\item{...}{Additional arguments (not used).} +} +\value{ +The first element of the vector. +} +\description{ +Returns the first element of a vector, optionally ordered by another vector. +} diff --git a/man/summary_kurtosis.Rd b/man/summary_kurtosis.Rd new file mode 100644 index 0000000..872d11c --- /dev/null +++ b/man/summary_kurtosis.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_kurtosis} +\alias{summary_kurtosis} +\title{Calculate Kurtosis} +\usage{ +summary_kurtosis(x, na.rm = FALSE, weights = NULL, type = 2, na_type = "", ...) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{weights}{Optional weights for the data.} + +\item{type}{Integer. Type of kurtosis calculation. Defaults to \code{2}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The kurtosis or weighted kurtosis of the dataset. +} +\description{ +Computes the kurtosis or weighted kurtosis of a dataset. +} diff --git a/man/summary_last.Rd b/man/summary_last.Rd new file mode 100644 index 0000000..d7ce86e --- /dev/null +++ b/man/summary_last.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_last} +\alias{summary_last} +\title{Get Last Element} +\usage{ +summary_last(x, order_by = NULL, ...) + +summary_last(x, order_by = NULL, ...) +} +\arguments{ +\item{x}{A vector.} + +\item{order_by}{Optional. A vector to order by before selecting the last element.} + +\item{...}{Additional arguments (not used).} +} +\value{ +The last element of the vector. + +The last element of the vector. +} +\description{ +Returns the last element of a vector, optionally ordered by another vector. + +Returns the last element of a vector, optionally ordered by another vector. +} diff --git a/man/summary_max.Rd b/man/summary_max.Rd new file mode 100644 index 0000000..26834e0 --- /dev/null +++ b/man/summary_max.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_max} +\alias{summary_max} +\title{Calculate Maximum Value} +\usage{ +summary_max(x, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The maximum value in the dataset. +} +\description{ +Computes the maximum value in a dataset. +} diff --git a/man/summary_max_circular.Rd b/man/summary_max_circular.Rd new file mode 100644 index 0000000..9321e2d --- /dev/null +++ b/man/summary_max_circular.Rd @@ -0,0 +1,34 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_max_circular} +\alias{summary_max_circular} +\title{Calculate the Maximum of Circular Data} +\usage{ +summary_max_circular( + x, + na.rm = FALSE, + names = FALSE, + type = 7, + na_type = "", + ... +) +} +\arguments{ +\item{x}{A vector of circular data.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{names}{Logical. Should the names of the quantiles be returned? Defaults to \code{FALSE}.} + +\item{type}{Integer. Type of quantile calculation.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The maximum of the circular data. +} +\description{ +Computes the maximum value of circular data using \code{circular::quantile.circular}. +} diff --git a/man/summary_mean.Rd b/man/summary_mean.Rd new file mode 100644 index 0000000..0f4f360 --- /dev/null +++ b/man/summary_mean.Rd @@ -0,0 +1,37 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_mean} +\alias{summary_mean} +\title{Calculate Mean of Data} +\usage{ +summary_mean( + x, + add_cols, + weights = NULL, + na.rm = FALSE, + trim = 0, + na_type = "", + ... +) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{add_cols}{Additional columns (not used directly in calculation).} + +\item{weights}{Optional weights for the data.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{trim}{Numeric. Fraction of observations to trim from each end before computing the mean.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The mean or weighted mean of the data. +} +\description{ +Computes the mean or weighted mean of a dataset. +} diff --git a/man/summary_median.Rd b/man/summary_median.Rd new file mode 100644 index 0000000..0658882 --- /dev/null +++ b/man/summary_median.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_median} +\alias{summary_median} +\title{Calculate Median} +\usage{ +summary_median(x, na.rm = FALSE, weights = NULL, na_type = "", ...) +} +\arguments{ +\item{x}{A numeric vector, ordered factor, or date.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{weights}{Optional weights for the data.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The median or weighted median of the dataset. +} +\description{ +Computes the median or weighted median of a dataset. Handles ordered factors and dates. +} diff --git a/man/summary_medianHL_circular.Rd b/man/summary_medianHL_circular.Rd new file mode 100644 index 0000000..33b253d --- /dev/null +++ b/man/summary_medianHL_circular.Rd @@ -0,0 +1,34 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_medianHL_circular} +\alias{summary_medianHL_circular} +\title{Calculate the Hodges-Lehmann Median of Circular Data} +\usage{ +summary_medianHL_circular( + x, + na.rm = FALSE, + method = c("HL1", "HL2", "HL3"), + prop = NULL, + na_type = "", + ... +) +} +\arguments{ +\item{x}{A vector of circular data.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{method}{Character string specifying the HL method ("HL1", "HL2", or "HL3").} + +\item{prop}{Numeric. Proportion of data to consider.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The Hodges-Lehmann median of the circular data. +} +\description{ +Computes the Hodges-Lehmann median of circular data using \code{circular::medianHL.circular}. +} diff --git a/man/summary_median_absolute_deviation.Rd b/man/summary_median_absolute_deviation.Rd new file mode 100644 index 0000000..1a54ca8 --- /dev/null +++ b/man/summary_median_absolute_deviation.Rd @@ -0,0 +1,40 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_median_absolute_deviation} +\alias{summary_median_absolute_deviation} +\title{Calculate Median Absolute Deviation} +\usage{ +summary_median_absolute_deviation( + x, + constant = 1.4826, + na.rm = FALSE, + na_type = "", + weights = NULL, + low = FALSE, + high = FALSE, + ... +) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{constant}{Numeric. Scale factor. Defaults to \code{1.4826}.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{weights}{Optional weights for the data.} + +\item{low}{Logical. Use only values below the median. Defaults to \code{FALSE}.} + +\item{high}{Logical. Use only values above the median. Defaults to \code{FALSE}.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The median absolute deviation or weighted absolute deviation. +} +\description{ +Computes the median absolute deviation or weighted absolute deviation. +} diff --git a/man/summary_median_circular.Rd b/man/summary_median_circular.Rd new file mode 100644 index 0000000..bf7e356 --- /dev/null +++ b/man/summary_median_circular.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_median_circular} +\alias{summary_median_circular} +\title{Calculate the Median of Circular Data} +\usage{ +summary_median_circular(x, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{A vector of circular data.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The median of the circular data. +} +\description{ +Computes the median of circular data using \code{circular::median.circular}. +} diff --git a/man/summary_min.Rd b/man/summary_min.Rd new file mode 100644 index 0000000..cae1ef7 --- /dev/null +++ b/man/summary_min.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_min} +\alias{summary_min} +\title{Calculate Minimum Value} +\usage{ +summary_min(x, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The minimum value in the dataset. +} +\description{ +Computes the minimum value in a dataset. +} diff --git a/man/summary_min_circular.Rd b/man/summary_min_circular.Rd new file mode 100644 index 0000000..ed4686e --- /dev/null +++ b/man/summary_min_circular.Rd @@ -0,0 +1,34 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_min_circular} +\alias{summary_min_circular} +\title{Calculate the Minimum of Circular Data} +\usage{ +summary_min_circular( + x, + na.rm = FALSE, + names = FALSE, + type = 7, + na_type = "", + ... +) +} +\arguments{ +\item{x}{A vector of circular data.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{names}{Logical. Should the names of the quantiles be returned? Defaults to \code{FALSE}.} + +\item{type}{Integer. Type of quantile calculation.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The minimum of the circular data. +} +\description{ +Computes the minimum value of circular data using \code{circular::quantile.circular}. +} diff --git a/man/summary_n_distinct.Rd b/man/summary_n_distinct.Rd new file mode 100644 index 0000000..b6a96d4 --- /dev/null +++ b/man/summary_n_distinct.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_n_distinct} +\alias{summary_n_distinct} +\title{Count Distinct Elements} +\usage{ +summary_n_distinct(x, na.rm = FALSE, ...) +} +\arguments{ +\item{x}{A vector of data.} + +\item{na.rm}{Logical. Should missing values (\code{NA}) be removed? Defaults to \code{FALSE}.} + +\item{...}{Additional arguments (not used).} +} +\value{ +The count of distinct elements in the vector. +} +\description{ +Counts the number of distinct elements in a vector. +} diff --git a/man/summary_nth.Rd b/man/summary_nth.Rd new file mode 100644 index 0000000..bef5444 --- /dev/null +++ b/man/summary_nth.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_nth} +\alias{summary_nth} +\title{Get nth Element} +\usage{ +summary_nth(x, nth_value, order_by = NULL, ...) + +summary_nth(x, nth_value, order_by = NULL, ...) +} +\arguments{ +\item{x}{A vector.} + +\item{nth_value}{Integer. The position of the element to return.} + +\item{order_by}{Optional. A vector to order by before selecting the nth element.} + +\item{...}{Additional arguments (not used).} +} +\value{ +The nth element of the vector. + +The nth element of the vector. +} +\description{ +Returns the nth element of a vector, optionally ordered by another vector. + +Returns the nth element of a vector, optionally ordered by another vector. +} diff --git a/man/summary_outlier_limit.Rd b/man/summary_outlier_limit.Rd new file mode 100644 index 0000000..7a7b817 --- /dev/null +++ b/man/summary_outlier_limit.Rd @@ -0,0 +1,46 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_outlier_limit} +\alias{summary_outlier_limit} +\title{Calculate Outlier Limits} +\usage{ +summary_outlier_limit( + x, + coef = 1.5, + bupperlimit = TRUE, + bskewedcalc = FALSE, + skewnessweight = 4, + na.rm = TRUE, + na_type = "", + omit = FALSE, + value = 0, + ... +) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{coef}{Numeric. Coefficient for the IQR. Defaults to \code{1.5}.} + +\item{bupperlimit}{Logical. Calculate upper limit if \code{TRUE}, lower limit otherwise. Defaults to \code{TRUE}.} + +\item{bskewedcalc}{Logical. Use skewness in the calculation if \code{TRUE}. Defaults to \code{FALSE}.} + +\item{skewnessweight}{Numeric. Weight for skewness in the calculation. Defaults to \code{4}.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{TRUE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{omit}{Logical. Omit values below a threshold. Defaults to \code{FALSE}.} + +\item{value}{Numeric. Threshold for omission. Defaults to \code{0}.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The calculated outlier limit. +} +\description{ +Computes the upper or lower outlier limits based on skewness and interquartile range. +} diff --git a/man/summary_quantile.Rd b/man/summary_quantile.Rd new file mode 100644 index 0000000..f57c436 --- /dev/null +++ b/man/summary_quantile.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_quantile} +\alias{summary_quantile} +\title{Calculate Quantile} +\usage{ +summary_quantile(x, na.rm = FALSE, weights = NULL, probs, na_type = "", ...) +} +\arguments{ +\item{x}{A numeric vector, ordered factor, or date.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{weights}{Optional weights for the data.} + +\item{probs}{Numeric vector of probabilities (e.g., 0.1 for 10th percentile).} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The quantile or weighted quantile of the dataset. +} +\description{ +Computes the quantile or weighted quantile of a dataset. Handles ordered factors and dates. +} diff --git a/man/summary_quantile_circular.Rd b/man/summary_quantile_circular.Rd new file mode 100644 index 0000000..2063171 --- /dev/null +++ b/man/summary_quantile_circular.Rd @@ -0,0 +1,37 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_quantile_circular} +\alias{summary_quantile_circular} +\title{Calculate Quantiles of Circular Data} +\usage{ +summary_quantile_circular( + x, + probs = seq(0, 1, 0.25), + na.rm = FALSE, + names = FALSE, + type = 7, + na_type = "", + ... +) +} +\arguments{ +\item{x}{A vector of circular data.} + +\item{probs}{Numeric vector of probabilities.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{names}{Logical. Should the names of the quantiles be returned? Defaults to \code{FALSE}.} + +\item{type}{Integer. Type of quantile calculation.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The quantiles of the circular data. +} +\description{ +Computes the quantiles of circular data using \code{circular::quantile.circular}. +} diff --git a/man/summary_range.Rd b/man/summary_range.Rd new file mode 100644 index 0000000..805da7f --- /dev/null +++ b/man/summary_range.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_range} +\alias{summary_range} +\title{Calculate Range} +\usage{ +summary_range(x, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The range of the dataset. +} +\description{ +Computes the range of a dataset (difference between the maximum and minimum values). +} diff --git a/man/summary_range_circular.Rd b/man/summary_range_circular.Rd new file mode 100644 index 0000000..4bf945a --- /dev/null +++ b/man/summary_range_circular.Rd @@ -0,0 +1,37 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_range_circular} +\alias{summary_range_circular} +\title{Calculate Range of Circular Data} +\usage{ +summary_range_circular( + x, + test = FALSE, + na.rm = FALSE, + finite = FALSE, + control.circular = list(), + na_type = "", + ... +) +} +\arguments{ +\item{x}{A vector of circular data.} + +\item{test}{Logical. Perform a statistical test on the range. Defaults to \code{FALSE}.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{finite}{Logical. Should only finite values be considered? Defaults to \code{FALSE}.} + +\item{control.circular}{List of control parameters for circular objects.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The range of the circular data. +} +\description{ +Computes the range of circular data using \code{circular::range.circular}. +} diff --git a/man/summary_rho_circular.Rd b/man/summary_rho_circular.Rd new file mode 100644 index 0000000..f68c361 --- /dev/null +++ b/man/summary_rho_circular.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_rho_circular} +\alias{summary_rho_circular} +\title{Calculate Rho of Circular Data} +\usage{ +summary_rho_circular(x, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{A vector of circular data.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The Rho of the circular data. +} +\description{ +Computes the Rho (mean resultant length) of circular data using \code{circular::rho.circular}. +} diff --git a/man/summary_sample.Rd b/man/summary_sample.Rd new file mode 100644 index 0000000..e1388ad --- /dev/null +++ b/man/summary_sample.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_sample} +\alias{summary_sample} +\title{Sample a Single Element} +\usage{ +summary_sample(x, replace = FALSE, seed, ...) +} +\arguments{ +\item{x}{A vector of data.} + +\item{replace}{Logical. Should sampling be with replacement? Defaults to \code{FALSE}.} + +\item{seed}{Optional. A seed for reproducibility.} + +\item{...}{Additional arguments (not used).} +} +\value{ +A randomly sampled element from the vector. +} +\description{ +Randomly samples a single element from a vector. +} diff --git a/man/summary_sd.Rd b/man/summary_sd.Rd new file mode 100644 index 0000000..fafe1d9 --- /dev/null +++ b/man/summary_sd.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_sd} +\alias{summary_sd} +\title{Calculate Standard Deviation} +\usage{ +summary_sd(x, na.rm = FALSE, weights = NULL, na_type = "", ...) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{weights}{Optional weights for the data.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The standard deviation or weighted standard deviation of the data. +} +\description{ +Computes the standard deviation or weighted standard deviation of a dataset. +} diff --git a/man/summary_sd_circular.Rd b/man/summary_sd_circular.Rd new file mode 100644 index 0000000..0e285d4 --- /dev/null +++ b/man/summary_sd_circular.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_sd_circular} +\alias{summary_sd_circular} +\title{Calculate the Standard Deviation of Circular Data} +\usage{ +summary_sd_circular(x, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{A vector of circular data.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The standard deviation of the circular data. +} +\description{ +Computes the standard deviation of circular data using \code{circular::sd.circular}. +} diff --git a/man/summary_skewness.Rd b/man/summary_skewness.Rd new file mode 100644 index 0000000..282f950 --- /dev/null +++ b/man/summary_skewness.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_skewness} +\alias{summary_skewness} +\title{Calculate Skewness} +\usage{ +summary_skewness(x, weights = NULL, na.rm = FALSE, type = 2, na_type = "", ...) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{weights}{Optional weights for the data.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{type}{Integer. Type of skewness calculation. Defaults to \code{2}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The skewness or weighted skewness of the dataset. +} +\description{ +Computes the skewness or weighted skewness of a dataset. +} diff --git a/man/summary_skewness_mc.Rd b/man/summary_skewness_mc.Rd new file mode 100644 index 0000000..d75aba7 --- /dev/null +++ b/man/summary_skewness_mc.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_skewness_mc} +\alias{summary_skewness_mc} +\title{Calculate Medcouple Skewness} +\usage{ +summary_skewness_mc(x, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The medcouple skewness. +} +\description{ +Computes the medcouple skewness using \code{robustbase::mc}. +} diff --git a/man/summary_sum.Rd b/man/summary_sum.Rd new file mode 100644 index 0000000..90799a8 --- /dev/null +++ b/man/summary_sum.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_sum} +\alias{summary_sum} +\title{Calculate Sum of Data} +\usage{ +summary_sum(x, weights = NULL, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{weights}{Optional weights for the data.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The sum or weighted sum of the data. +} +\description{ +Computes the sum or weighted sum of a dataset. +} diff --git a/man/summary_trimmed_mean.Rd b/man/summary_trimmed_mean.Rd new file mode 100644 index 0000000..109094e --- /dev/null +++ b/man/summary_trimmed_mean.Rd @@ -0,0 +1,37 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_trimmed_mean} +\alias{summary_trimmed_mean} +\title{Calculate Trimmed Mean of Data} +\usage{ +summary_trimmed_mean( + x, + add_cols, + weights = NULL, + na.rm = FALSE, + trimmed = 0, + na_type = "", + ... +) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{add_cols}{Additional columns (not used directly in calculation).} + +\item{weights}{Optional weights for the data.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{trimmed}{Numeric. Fraction of observations to trim from each end before computing the mean.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The trimmed mean of the data. +} +\description{ +Computes the trimmed mean of a dataset. +} diff --git a/man/summary_var.Rd b/man/summary_var.Rd new file mode 100644 index 0000000..f98408a --- /dev/null +++ b/man/summary_var.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_var} +\alias{summary_var} +\title{Calculate Variance} +\usage{ +summary_var(x, na.rm = FALSE, weights = NULL, na_type = "", ...) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{weights}{Optional weights for the data.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The variance or weighted variance of the data. +} +\description{ +Computes the variance or weighted variance of a dataset. +} diff --git a/man/summary_var_circular.Rd b/man/summary_var_circular.Rd new file mode 100644 index 0000000..6977bea --- /dev/null +++ b/man/summary_var_circular.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_var_circular} +\alias{summary_var_circular} +\title{Calculate the Variance of Circular Data} +\usage{ +summary_var_circular(x, na.rm = FALSE, na_type = "", ...) +} +\arguments{ +\item{x}{A vector of circular data.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{FALSE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The variance of the circular data. +} +\description{ +Computes the variance of circular data using \code{circular::var.circular}. +} diff --git a/man/summary_where_max.Rd b/man/summary_where_max.Rd new file mode 100644 index 0000000..cefb062 --- /dev/null +++ b/man/summary_where_max.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_where_max} +\alias{summary_where_max} +\title{Get Corresponding Value for Maximum} +\usage{ +summary_where_max(x, summary_where_y = NULL, na.rm = TRUE, na_type = "", ...) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{summary_where_y}{A vector of values corresponding to \code{x}.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{TRUE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The value in \code{summary_where_y} corresponding to the maximum value in \code{x}. +} +\description{ +Returns the value in another vector corresponding to the maximum value in a dataset. +} diff --git a/man/summary_where_min.Rd b/man/summary_where_min.Rd new file mode 100644 index 0000000..42c8dc8 --- /dev/null +++ b/man/summary_where_min.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_where_min} +\alias{summary_where_min} +\title{Get Corresponding Value for Minimum} +\usage{ +summary_where_min(x, summary_where_y = NULL, na.rm = TRUE, na_type = "", ...) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{summary_where_y}{A vector of values corresponding to \code{x}.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{TRUE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +The value in \code{summary_where_y} corresponding to the minimum value in \code{x}. +} +\description{ +Returns the value in another vector corresponding to the minimum value in a dataset. +} diff --git a/man/summary_which_max.Rd b/man/summary_which_max.Rd new file mode 100644 index 0000000..77ba6a7 --- /dev/null +++ b/man/summary_which_max.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_which_max} +\alias{summary_which_max} +\title{Get Indices of Maximum Value} +\usage{ +summary_which_max(x, na.rm = TRUE, na_type = "", ...) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{TRUE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +A vector of indices corresponding to the maximum value. +} +\description{ +Finds all indices of the maximum value in a dataset. +} diff --git a/man/summary_which_min.Rd b/man/summary_which_min.Rd new file mode 100644 index 0000000..ad2c1c4 --- /dev/null +++ b/man/summary_which_min.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/summary_functions.R +\name{summary_which_min} +\alias{summary_which_min} +\title{Get Indices of Minimum Value} +\usage{ +summary_which_min(x, na.rm = TRUE, na_type = "", ...) +} +\arguments{ +\item{x}{A numeric vector.} + +\item{na.rm}{Logical. Should missing values be removed? Defaults to \code{TRUE}.} + +\item{na_type}{Character string indicating the type of NA check to perform.} + +\item{...}{Additional arguments passed to \code{na_check}.} +} +\value{ +A vector of indices corresponding to the minimum value. +} +\description{ +Finds all indices of the minimum value in a dataset. +}