Learn R Programming

tablet (version 0.5.8)

groupwise.data.frame: Calculate Widgets With and Without Groups

Description

Calculates widgets with and without groups. Supplies 'groupfull' and 'groupless' (prefixed) columns instead of 'widgets'. Column attributes 'label' and 'title' (highest priority) are substituted for column name, if present.

Usage

# S3 method for data.frame
groupwise(
  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))),
  fac = list(` ` ~ sum + " (" + pct + "%" + ")"),
  num = list(`Mean (SD)` ~ ave + " (" + std + ")", `Median (range)` ~ med + " (" + min
    + ", " + max + ")"),
  ...
)

Value

class 'groupwise', arranged by groups:

_tablet_name

observation identifier

_tablet_level

factor level (or special value 'numeric' for numerics)

_tablet_N

number of records

_tablet_n

number of records in group

_tablet_stat

the LHS of formulas in 'fac' and 'num'

_tablet_groupfull

the LHS of formulas in 'fac' and 'num'

_tablet_groupless

the LHS of formulas in 'fac' and 'num'

Arguments

x

data.frame

fun

passed to groupfull() and groupless()

fac

passed to groupfull() and groupless()

num

passed to groupfull() and groupless()

...

passed to groupfull() and groupless()