Learn R Programming

broom (version 0.3.4)

data.frame_tidiers: Tidiers for data.frame objects

Description

These perform tidy summaries of data.frame objects. tidy produces summary statistics about each column, while glance simply reports the number of rows and columns. Note that augment.data.frame will throw an error.

Usage

## S3 method for class 'data.frame':
tidy(x, ...)

## S3 method for class 'data.frame': augment(x, data, ...)

## S3 method for class 'data.frame': glance(x, ...)

Arguments

x
A data.frame
...
extra arguments: for tidy, these are passed on to describe from psych package
data
data, not used

Value

  • tidy.data.frame produces a data frame with one row per original column, containing summary statistics of each:
  • columnname of original column
  • nNumber of valid (non-NA) values
  • meanmean
  • sdstandard deviation
  • medianmedian
  • trimmedtrimmed mean, with trim defaulting to .1
  • madmedian absolute deviation (from the median)
  • minminimum value
  • maxmaximum value
  • rangerange
  • skewskew
  • kurtosiskurtosis
  • sestandard error
  • glance returns a one-row data.frame with
  • nrownumber of rows
  • ncolnumber of columns
  • complete.obsnumber of rows that have no missing values
  • na.fractionfraction of values across all rows and columns that are missing

Details

The tidy method calls the psych method describe directly to produce its per-columns summary statistics.

See Also

describe

Examples

Run this code
td <- tidy(mtcars)
td

glance(mtcars)

library(ggplot2)
# compare mean and standard deviation
ggplot(td, aes(mean, sd)) + geom_point() +
     geom_text(aes(label = column), hjust = 1, vjust = 1) +
     scale_x_log10() + scale_y_log10() + geom_abline()

Run the code above in your browser using DataLab