# complete_cases: Statistics/Summaries with (Only) Missing Data Removed In roperators: Additional Operators to Help you Write Cleaner R Code

## Description

Univariate and bivariate summaries and statistics with the least missing data removed (such as complete-cases correlations). These are typically default arguments to standard statistics functions.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45``` ```length_cc(x, ...) n_unique_cc(x, ...) min_cc(x, ...) max_cc(x, ...) range_cc(x, ...) all_cc(x, ...) any_cc(x, ...) sum_cc(x, ...) prod_cc(x, ...) mean_cc(x, ...) median_cc(x, ...) var_cc(x, y = NULL, ...) cov_cc(x, y = NULL, ...) cor_cc(x, y = NULL, ...) sd_cc(x, ...) weighted.mean_cc(x, w, ...) quantile_cc(x, ...) IQR_cc(x, ...) mad_cc(x, ...) rowSums_cc(x, ...) colSums_cc(x, ...) rowMeans_cc(x, ..., rescale = FALSE) colMeans_cc(x, ..., rescale = FALSE) ```

## Arguments

 `x` An R object. Currently there are methods for numeric/logical vectors and date, date-time and time interval objects. Complex vectors are allowed for `trim = 0`, only. `...` arguments to pass to wrapped functions `y` `NULL` (default) or a vector, matrix or data frame with compatible dimensions to `x`. The default is equivalent to `y = x` (but more efficient). `w` a numerical vector of weights the same length as `x` giving the weights to use for elements of `x`. `rescale` whether to rescale the matrix/df/vector before calculating summaries

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ```n_o <- 20 n_m <- round(n_o / 3) x <- rnorm(n_o) y <- rnorm(n_o) x[sample(n_o, n_m)] <- NA y[sample(n_o, n_m)] <- NA mean_cc(x) # mean of complete cases mean_cc(y) var_cc(x) # variance of complete cases var_cc(y) cor_cc(x, y) # correlation between available cases ```

roperators documentation built on Feb. 10, 2022, 1:07 a.m.