devalued.observations {tablet} | R Documentation |
Aggregate Values for Observations Aggregates values for observations. Accepts a list of formulas with result name on left and aggregating expression on the right. Behavior is undefined if any expression does not aggregate! (I.e., length != 1). Expressions are evaluated in an environment where values are available as 'x', grouped count is available as 'n' and ungouped count is available as 'N'.
Description
Aggregate Values for Observations Aggregates values for observations. Accepts a list of formulas with result name on left and aggregating expression on the right. Behavior is undefined if any expression does not aggregate! (I.e., length != 1). Expressions are evaluated in an environment where values are available as 'x', grouped count is available as 'n' and ungouped count is available as 'N'.
Usage
## S3 method for class 'observations'
devalued(
x,
...,
fun = list(sum ~ sum(x, na.rm = TRUE), pct ~ signif(digits = 3, sum/n * 100), ave ~
signif(digits = 3, mean(x, na.rm = TRUE)), std ~ signif(digits = 3, sd(x, na.rm =
TRUE)), med ~ signif(digits = 3, median(x, na.rm = TRUE)), min ~ signif(digits = 3,
min(x, na.rm = TRUE)), max ~ signif(digits = 3, max(x, na.rm = TRUE))),
silent = TRUE
)
Arguments
x |
observations |
... |
passed formulas with matching LHS will replace corresponding element of fun. |
fun |
default aggregate functions expressed as formulas |
silent |
whether to suppress warnings from evaluations of 'fun' |
Value
class 'devalued', presumably one record per group:
_tablet_N |
number of records |
_tablet_n |
number of records in group |
_tablet_name |
observation identifier |
_tablet_level |
factor level (or special value 'numeric' for numerics) |
(other) |
additional column for each statistic in 'fun' |