summary_stats: Summarizing Variables by their Tendency and Distribution

Description Usage Arguments Value See Also Examples

Description

Quick displays of tendency and distribution of variables recorded in repetitions may be required for plotting dots with error bars. The function summary_stats() retrieves a data frame with the tendency and spread of values of a variable by one or more factors.

Calculation of tendency and distribution parameters for variables grouped by a combination of factors. This function is applying aggregate() for grouping observations.

In the method 'formula', the terms are expressed as variable ~ factors.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
summary_stats(x, ...)

## S4 method for signature 'formula'
summary_stats(
  x,
  trend = mean,
  spread = sd,
  data,
  trend_args = list(),
  spread_args = list()
)

## S4 method for signature 'character'
summary_stats(
  x,
  factors,
  trend = mean,
  spread = sd,
  data,
  trend_args = list(),
  spread_args = list()
)

Arguments

x

Either a formula or a character vector with the name of variables.

...

Further arguments passed among methods.

trend, spread

The trend and spread functions.

data

A data frame containing the records.

trend_args, spread_args

Lists of further arguments required by the trend and spread functions, respectively.

factors

Character vector indicating categorical variables for grouping the values.

Value

A data frame with one column for the variables, each factor as a column and the values of tendency and dispersion.

See Also

aggregate().

Examples

1
2
3
4
data(maize_model)

## The formula method
summary_stats(wrt + wst + wglv + wgld + yield ~ treatment, data=maize_model)

kamapu/cropgrowth documentation built on Aug. 22, 2021, 8:55 a.m.