tsum2: Table Summary with 2 independent (x) variables

View source: R/tsum2.R

tsum2R Documentation

Table Summary with 2 independent (x) variables

Description

Summarize a continuous dependent (y) variable with two independent (x) variables.

Usage

  tsum2(d, y, l, u, e=c("Mean", "SD", "N"), h=NULL, ol="", ou="", rm.dup=TRUE, 
        repl=list(c("length"), c("n")))

Arguments

d

a data.frame or matrix with column names

y

y variable name, a continuous variable

l

x variable name to be shown on the left side

u

x variable name to be shown on the upper side

e

a vector of summary function names

h

a vector of summary function names for the horizontal subgroup. If NULL, it becomes the same as the e argument.

ol

order of levels of the left side x variable

ou

order of levels of the upper side x variable

rm.dup

if TRUE, duplicated names of levels are specified on the first occurrence only.

repl

a list of strings to replace after summarization. The length of the list should be 2, and both elements should have the same length.

Details

A convenient summarization function for a continuous variable with two x variables; one on the left side, the other on the upper side.

Value

A data.frame of summarized values. Column names are from the levels of u. Row names are basically from the levels of l.

Author(s)

Kyun-Seop Bae k@acr.kr

See Also

tsum, tsum0, tsum1, tsum3

Examples

  tsum2(CO2, "uptake", "Type", "Treatment")
  tsum2(CO2, "uptake", "Type", "conc")
  tsum2(CO2, "uptake", "Type", "Treatment", 
        e=c("mean", "median", "sd", "min", "max", "length"), 
        ou=c("chilled", "nonchilled"),
        repl=list(c("median", "length"), c("med", "n")))

sasLM documentation built on June 15, 2026, 9:07 a.m.