Skip to contents

Summarise and annotate data

Usage

bru_summarise(
  data,
  probs = c(0.025, 0.5, 0.975),
  x = NULL,
  cbind.only = FALSE,
  max_moment = 2
)

Arguments

data

A list of samples, each either numeric or a data.frame

probs

A numeric vector of probabilities with values in [0, 1], passed to stats::quantile

x

A data.frame of data columns that should be added to the summary data frame

cbind.only

If TRUE, only cbind the samples and return a matrix where each column is a sample

max_moment

integer, at least 2. Determines the largest moment order information to include in the output. If max_moment > 2, includes "skew" (skewness, E[(x-m)^3/s^3]), and if max_moment > 3, includes "ekurtosis" (excess kurtosis, E[(x-m)^4/s^4] - 3). Default 2. Note that the Monte Carlo variability of the ekurtois estimate may be large.

Value

A data.frame or Spatial[Points/Pixels]DataFrame with summary statistics, "mean", "sd", paste0("q", probs), "mean.mc_std_err", "sd.mc_std_err"

Examples

bru_summarise(matrix(rexp(10000), 10, 1000), max_moment = 4, probs = NULL)
#>         mean        sd     skew ekurtosis sd.mc_std_err mean.mc_std_err
#> 1  1.0010880 1.0156789 2.180656  7.320498    0.04903347      0.03521974
#> 2  0.9519697 0.9268446 1.624580  2.797863    0.03210639      0.03133999
#> 3  0.9970469 0.9970097 2.026603  6.280112    0.04536699      0.03439748
#> 4  1.0131649 0.9639471 1.702418  3.605621    0.03609214      0.03276535
#> 5  0.9747426 0.9622593 1.672917  3.040846    0.03416647      0.03259019
#> 6  1.0068025 1.0550962 2.316933  7.889020    0.05246657      0.03668335
#> 7  0.9582877 0.9409593 1.998839  5.666845    0.04120082      0.03236152
#> 8  1.0636858 1.0498080 1.865887  4.790975    0.04326234      0.03593399
#> 9  1.0529362 1.1242614 2.331727  8.141976    0.05661630      0.03913300
#> 10 1.0313465 0.9896316 1.618757  2.797992    0.03428182      0.03346307