remix (version 2.1)

remix: Remix and describe.

Description

A quick and easy function for describing datasets.

Usage

remix(formula = cbind(...) ~ ., data = NULL, funs = c(mean, sd, quantile, n, na), ..., cum = FALSE, margin = 0:2, addmargins = FALSE, useNA = c("no", "ifany", "always"), propNA = TRUE, revert = FALSE, method = c("pearson", "kendall", "spearman"), times = NULL, followup = FALSE, test = FALSE, test.summarize = test.summarize.auto, test.survival = test.survival.logrank, test.tabular = test.tabular.auto, show.test = display.test, plim = 4, show.method = TRUE, label = FALSE)

Arguments

formula
a formula (see Details).
data
a data.frame.
funs
functions for describing numeric variable. Can be c(fun1, fun2, fun3) or c("fun1", "fun2", "fun3") or a list.
...
further arguments (all passed to funs), for example na.rm = TRUE
cum
should cumulated frequencies be reported?
margin
index, or vector of indices to generate proportion in frequency tables (0: cell, 1: row, 2: col).
addmargins
whether to add margins
useNA
whether to include NA as a level (factor)
propNA
whether to include NA in proportion calculation
revert
whether to regroup factors or numeric variables when crossing factor with numeric variables
method
a character string indicating which correlation coefficient is to be used. One of "pearson", "kendall", or "spearman", can be abbreviated.
times
vector of times (see ?summary.survival un package survival)
followup
whether to display follow-up time
test
whether to perform tests
test.summarize
a function of two arguments (continuous variable and grouping variable) used to compare continuous variable, that return a list of two components : p.value and method (the test name). See test.summarize.auto, test.summarize.kruskal, test.summarize.oneway.equalvar, or test.summarize.unequalvar for example of such functions. Users can provide their own function.
test.survival
a function of one argument (a formula) used to compare survival estimations, that returns the same components as created by test.summarize. See test.survival.logrank. Users can provide their own function.
test.tabular
a function of three arguments (two categorical variables and a logical na) used to test association between two factors, that returns the same components as created by test.summarize. See test.tabular.auto and test.tabular.fisher. Users can provide their own function.
show.test
a function used to display the test result. See display.test.
plim
number of digits for the p value
show.method
should display the test name?
label
whether to display labels of variables (using label in package Hmisc)

Value

A remix object, basically a list with descriptive tables. It uses ascii package for printing output, and can be use with ascii function.

See Also

cast (reshape) and summary.formula (Hmisc).

Examples

Run this code
parwidth <- getOption("width")
options(width = 100)

library(remix)
remix(data = iris)
remix(cbind(...) ~ ., iris[, sapply(iris, is.numeric)], funs = c(median, mad, min, max))
remix(cbind(Sepal.Length, I(Sepal.Width^2)) ~ Species, iris, funs = quantile, probs = c(1/3, 2/3))
remix(Sepal.Length + Sepal.Width ~ Petal.Length + Petal.Width, iris)
remix(cbind(Sepal.Length, Sepal.Width) ~ cbind(Petal.Length, Petal.Width), iris)
remix(... ~ ., esoph, cum = TRUE)
remix(alcgp ~ tobgp, esoph, cum = TRUE)
remix(Surv(time, status) ~ x, data = aml, times = seq(0, 120, 12))

options(width = parwidth)

Run the code above in your browser using DataLab