Learn R Programming

benchr (version 0.2.5)

mean.benchmark: Mean method for the benchmark timings.

Description

This method computes aggregated statistics (sample mean and confidence intervals) for each expression.

Usage

# S3 method for benchmark
mean(x, trim = 0.05, conf.level = 0.95, relative = "mean", ...)

Arguments

x

An object of class benchmark.

trim

Numeric. The fraction (0 to 0.5) of observations to be trimmed before the mean is computed.

conf.level

Numeric. Confidence level of the interval.

relative

Character. The name or index of the column whose values will be used to compute relative timings.

Not currently used.

Value

The method returns a data.frame with additional attributes, which contains these columns:

expr

The deparsed expression as passed to benchmark or the name of the argument if the expression was passed as a named argument.

mean

Sample mean for timing results.

trimmed

Trimmed sample mean for timing results (a fraction of observations to be trimmed is defined by the argument trim).

lw.ci

Lower boundary for the confidence level (confidence level is specified by the argument conf.level).

up.ci

Upper boundary for the confidence level (confidence level is specified by the argument conf.level).

relative

Relative difference across expressions compared to a minimal value in the column, specified by the argument relative.

Additional attributes:

units

Units for time intervals.

conf.level

Confidence level.

trim

Fraction of observations that was trimmed before the trimmed mean was computed.

See Also

summary.benchmark()

Examples

Run this code
# NOT RUN {
timings <- benchmark(
  rchisq(100, 0), rchisq(100, 1), rchisq(100, 2),
  rchisq(100, 3), rchisq(100, 5),
  times = 1000L
)
mean(timings)
# }

Run the code above in your browser using DataLab