Description Usage Arguments Value Author(s) Examples
View source: R/summary_functions.R
This function returns the proportion based on a threshold and inequality defined. It also allow flexible definition of missing values.
1 2 | summary_proportions(x, prop_test = "==", prop_value,
as_percentage = FALSE, na.rm = FALSE, na_type = "", dp = 2, ...)
|
x |
A numeric vector. |
prop_test |
The inequlity to be applied in the test i.e '>, <, >=, <=, =='. |
prop_value |
The proportion value threshold. This is used with 'prop_test'. |
as_percentage |
Boolean value set to TRUE if percentages are required. |
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". |
dp |
Integer indicating the number of decimal places (round) to be used. By default "dp=2". |
... |
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. |
The proportion value.
Shadrack Kibet
1 2 3 4 | x <- c(1:10, NA, NA, NA, 2, 5, 6, 7)
summary_proportions(x, prop_test = ">", prop_value = 2, na.rm = TRUE, na_type = "n", na_max_n = 3, probs = 0.25)
summary_proportions(x, prop_test = "<", prop_value = 5, na.rm = TRUE, na_type = "con", na_consecutive_n = 3, probs = 0.75)
summary_proportions(x, prop_test = "<", prop_value = 5, as_percentage = TRUE, na.rm = TRUE, na_type = "con", na_consecutive_n = 3, probs = 0.75)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.