Last chance! 50% off unlimited learning
Sale ends in
Data frame tidiers are deprecated and will be removed from an upcoming release of broom.
# S3 method for data.frame
tidy(x, ..., na.rm = TRUE, trim = 0.1)# S3 method for data.frame
glance(x, ...)
A data.frame
Additional arguments for other methods.
a logical value indicating whether NA
values should
be stripped before the computation proceeds.
the fraction (0 to 0.5) of observations to be trimmed from
each end of x
before the mean is computed. Passed to the
trim
argument of mean()
data, not used
tidy.data.frame
produces a data frame with one
row per original column, containing summary statistics of each:
name of original column
Number of valid (non-NA) values
mean
standard deviation
median
trimmed mean, with trim defaulting to .1
median absolute deviation (from the median)
minimum value
maximum value
range
skew
kurtosis
standard error
glance returns a one-row data.frame with
number of rows
number of columns
number of rows that have no missing values
fraction of values across all rows and columns that are missing
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.
# NOT RUN {
# }
# NOT RUN {
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()
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab