summary_counts: Counts function

Description Usage Arguments Value Author(s) Examples

View source: R/summary_functions.R

Description

This function returns the counts based on a defined threshold, it allows use of inequality signs and flexible definition of missng values.

Usage

1
2
summary_counts(x, count_test = "==", count_value, na.rm = FALSE,
  na_type = "", ...)

Arguments

x

A numeric vector.

count_test

The inequlity to be applied in the test i.e '>, <, >=, <=, =='.

count_value

The count value threshold. This is used with 'count_test'.

na.rm

A logical value indicating whether missing values should be stripped before the computation proceeds.

na_type

A vector of strings that defines the type of missing value criteria e.g "n", "con", "prop", "FUN".

...

Additional parameters that could be passed internally. for example "na_consecutive_n = 3" to define the maximum allowed number of consecutive missing values. Other parameters include "na_max_n", "na_min_n","n_non_miss", "na_max_prop" for maximum, minimum and proportion of missing values.

Value

The count value.

Author(s)

Shadrack Kibet

Examples

1
2
3
x <- c(1:10, NA, NA, NA, 2, 5, 6, 7)
summary_counts(x, count_test = ">", count_value = 2, na.rm = TRUE, na_type = "n", na_max_n = 3, probs = 0.25)
summary_counts(x, count_test = "<", count_value = 5, na.rm = TRUE, na_type = "con", na_consecutive_n = 3, probs = 0.75)

shadrackkibet/summaryR documentation built on Jan. 2, 2020, 12:54 a.m.