Learn R Programming

rgr (version 1.0.4)

gx.stats: Compute Summary Statistics

Description

Function to compute summary statistics for a 'one-page' report and display in inset. Function may be used stand-alone.

Usage

gx.stats(xx, xlab = deparse(substitute(xx)), display = TRUE)

Arguments

xx
name of the variable to be processed.
xlab
a title for the table. It is often desirable to replace the default table title of the input variable name text string with a more informative title, e.g., xlab = "Cu (mg/kg) in <2 mm="" o-horizon="" soil"<="" code="">.
display
if display = TRUE the summary statistics are displayed on the current device. If display = FALSE output is suppressed.

Value

  • tablethe computed summary statistics to be used in function inset. The list returned, table, is a 26-element vector, see below.
  • [1:10]the minimum value, and the 1st, 2nd, 5th, 10th, 20th, 25th (Q1), 30th, 40 and 50th(Q2) percentiles
  • [11:19]the 60th, 70th, 75th(Q3), 80th 90th, 95th, 98th and 99th percentiles and the maximum value
  • [20]the sample size, N
  • [21]the Median Absolute Deviation (MAD)
  • [22]The Inter-Quartile Standard Deviation (IQSD)
  • [23]the data (sample) Mean
  • [24]the data (sample) Variance
  • [25]the data (sample) Standard Deviation (SD)
  • [26]the Coefficient of Variation as a percentage (CV%)

Details

The summary statistics comprise the data minimum, maximum and percentile values, robust estimates of standard deviation, the Median Absolute Deviation (MAD) and the Inter Quartile Standard Deviation (IQSD), and the mean, variance, standard deviation (SD) and coefficient of variation (CV%).

See Also

ltdl.fix.df, remove.na

Examples

Run this code
## Make test data available
data(kola.o)
attach(kola.o)

## Generates an initial display
gx.stats(Cu)

## Provides a more appropriate labelled display
gx.stats(Cu, xlab = "Cu (mg/kg) in <2 mm O-horizon soil")

## Detach test data
detach(kola.o)

Run the code above in your browser using DataLab