Description Usage Arguments Value Note Author(s) See Also Examples
A quick and easy function for describing datasets.
1 2 3 4 5 6 7 8 9 10 | 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)
|
formula |
a formula (see Details). |
data |
a data.frame. |
funs |
functions for describing numeric variable.
Can be |
... |
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
|
times |
vector of times (see
|
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 : |
test.survival |
a function of one argument (a
formula) used to compare survival estimations, that
returns the same components as created by
|
test.tabular |
a function of three arguments (two
categorical variables and a logical |
show.test |
a function used to display the test
result. See |
plim |
number of digits for the p value |
show.method |
should display the test name? |
label |
whether to display labels of variables
(using |
A remix object, basically a list with descriptive tables.
It uses ascii
package for printing output, and can
be use with ascii
function.
The formula has the following format: x_1 + x_2 +
... ~ y_1 + y_2 + ...
There are a couple of special variables: ...
represents all other variables not used in the formula
and .
represents no variable, so you can do
formula = var1 ~ .
.
If var1
is numeric, var1 ~ .
produce a
summary table using funs
. If var1
is a
factor, var1 ~ .
produce a frequency table. If
var1
is of class Surv
, var1 ~ .
produce a table with the estimates of survival at
times
. If var1
is numeric and var2
is numeric, var1 ~ var2
gives correlation. if
var1
is numeric and var2
is a factor,
var1 ~ var2
produce a summary table using
funs
according to the levels of var2
. If
var1
is a factor and var2
is a factor,
var1 ~ var2
produce a contingency table. If
var1
is of class Surv
and var2
is a
factor, var1 ~ var2
produce a table with the
estimates of survival for each level of var2
.
You can group several variables of the same type (numeric
or factor) together with cbind(var1, var2, var3)
,
they will be grouped in the same table. cbind(...)
works (ie regroups all variables of the same type).
David Hajage, inspired by the design and the code of
summary.formula
(Hmisc
package, FE Harrell)
and cast
(reshape
package, H Wickham).
cast
(reshape) and summary.formula
(Hmisc).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.