Skip to contents

Customised summaries of vectors with appropriate defaults for longitudinal data. The functions are prefixed with b_ to assist with autocomplete. It uses na.rm = TRUE for all, and for calculations involving quantiles, type = 8 and names = FALSE. Summaries include: * b_min: The minimum * b_max: The maximum * b_median: The median * b_mean: The mean * b_q25: The 25th quantile * b_q75: The 75th quantile * b_range: The range * b_range_diff: difference in range (max - min) * b_sd: The standard deviation * b_var: The variance * b_mad: The mean absolute deviation * b_iqr: The Inter-quartile range * b_diff_var: The variance diff() * b_diff_sd: The standard deviation of diff() * b_diff_mean: The mean of diff() * b_diff_median: The median of diff() * b_diff_q25: The q25 of diff() * b_diff_q75: The q75 of diff()

Usage

b_min(x, ...)

b_max(x, ...)

b_median(x, ...)

b_mean(x, ...)

b_q25(x, ...)

b_q75(x, ...)

b_range(x, ...)

b_range_diff(x, ...)

b_sd(x, ...)

b_var(x, ...)

b_mad(x, ...)

b_iqr(x, ...)

b_diff_var(x, ...)

b_diff_sd(x, ...)

b_diff_mean(x, ...)

b_diff_median(x, ...)

b_diff_q25(x, ...)

b_diff_q75(x, ...)

b_diff_max(x, ...)

b_diff_min(x, ...)

b_diff_iqr(x, ...)

Arguments

x

a vector

...

other arguments to pass

Examples


x <- c(1:5, NA, 5:1)
min(x)
#> [1] NA
b_min(x)
#> [1] 1
max(x)
#> [1] NA
b_max(x)
#> [1] 5
median(x)
#> [1] NA
b_median(x)
#> [1] 3
mean(x)
#> [1] NA
b_mean(x)
#> [1] 3
range(x)
#> [1] NA NA
b_range(x)
#> [1] 1 5
var(x)
#> [1] NA
b_var(x)
#> [1] 2.222222
sd(x)
#> [1] NA
b_sd(x)
#> [1] 1.490712