Usage
"describe"(x, descript, exclude.missing=TRUE, digits=4, listunique=0, listnchar=12, weights=NULL, normwt=FALSE, minlength=NULL, ...)
"describe"(x, descript, exclude.missing=TRUE, digits=4, ...)
"describe"(x, descript, exclude.missing=TRUE, digits=4, ...)
"describe"(x, descript, data, subset, na.action, digits=4, weights, ...)
"print"(x, ...)
"latex"(object, title=NULL, file=paste('describe',first.word(expr=attr(object,'descript')),'tex',sep='.'), append=FALSE, size='small', tabular=TRUE, greek=TRUE, spacing=0.7, lspace=c(0,0), ...)
"latex"(object, title=NULL, vname, file, append=FALSE, size='small', tabular=TRUE, greek=TRUE, lspace=c(0,0), ...)
"html"(object, size=85, tabular=TRUE, greek=TRUE, scroll=FALSE, rows=25, cols=100, ...)
"html"(object, vname, size=85, tabular=TRUE, greek=TRUE, ...)
formatdescribeSingle(x, condense=c('extremes', 'frequencies', 'both', 'none'), lang=c('plain', 'latex', 'html'), verb=0, lspace=c(0, 0), size=85, ...)
"plot"(x, which=c('both', 'continuous', 'categorical'), what=NULL, sort=c('ascending', 'descending', 'none'), n.unique=10, digits=5, ...)
Arguments
x
a data frame, matrix, vector, or formula. For a data frame, the
describe.data.frame
function is automatically invoked. For a matrix, describe.matrix
is
called. For a formula, describe.data.frame(model.frame(x))
is invoked. The formula may or may not have a response variable. For
print
, latex
, html
, or
formatdescribeSingle
, x
is an object created by
describe
.
descript
optional title to print for x. The default is the name of the argument
or the "label" attributes of individual variables. When the first argument
is a formula, descript
defaults to a character representation of
the formula.
exclude.missing
set toTRUE to print the names of variables that contain only missing values.
This list appears at the bottom of the printout, and no space is taken
up for such variables in the main listing.
digits
number of significant digits to print. For plot.describe
is
the number of significant digits to put in hover text for
plotly
when showing raw variable values.
listunique
For a character variable that is not an mChoice
variable, that
has its longest string length greater than listnchar
, and that
has no more than listunique
distinct values, all values are
listed in alphabetic order. Any value having more than one occurrence
has the frequency of occurrence after it, in parentheses. Specify
listunique
equal to some value at least as large as the number
of observations to ensure that all character variables will have all
their values listed. For purposes of tabulating character strings,
multiple white spaces of any kind are translated to a single space,
leading and trailing white space are ignored, and case is ignored.
weights
a numeric vector of frequencies or sample weights. Each observation
will be treated as if it were sampled weights
times.
minlength
value passed to summary.mChoice.
normwt
The default, normwt=FALSE
results in the use of weights
as
weights in computing various statistics. In this case the sample size
is assumed to be equal to the sum of weights
. Specify
normwt=TRUE
to divide
weights
by a constant so that weights
sum to the number of
observations (length of vectors specified to describe
). In this
case the number of observations is taken to be the actual number of
records given to describe
.
object
a result of describe
na.action
These are used if a formula is specified. na.action
defaults to
na.retain
which does not delete any NA
s from the data frame.
Use na.action=na.omit
or na.delete
to drop any observation with
any NA
before processing.
...
arguments passed to describe.default
which are passed to calls
to format
for numeric variables. For example if using R
POSIXct
or Date
date/time formats, specifying
describe(d,format='%d%b%y')
will print date/time variables as
"01Jan2000"
. This is useful for omitting the time
component. See the help file for format.POSIXct
or
format.Date
for more
information. For plot
methods, ... is ignored.
For html
and latex
methods, ... is used to pass
optional arguments to formatdescribeSingle
, especially the
condense
argument.
file
name of output file (should have a suffix of .tex). Default name is
formed from the first word of the descript
element of the
describe
object, prefixed by "describe"
. Set
file=""
to send LaTeX code to standard output instead of a file.
append
set to TRUE
to have latex
append text to an existing file
named file
size
LaTeX text size ("small"
, the default, or "normalsize"
,
"tiny"
, "scriptsize"
, etc.) for the describe
output
in LaTeX. For html is the percent of the prevailing font size to use for
the output.
tabular
set to FALSE
to use verbatim rather than tabular (or html
table) environment for the summary statistics output. By default,
tabular is used if the output is not too wide.
greek
By default, the latex
and html
methods
will change names of greek letters that appear in variable
labels to appropriate LaTeX symbols in math mode, or html symbols, unless
greek=FALSE
.
spacing
By default, the latex
method for describe
run
on a matrix or data frame uses the setspace
LaTeX package with a
line spacing of 0.7 so as to no waste space. Specify spacing=0
to suppress the use of the setspace
's spacing
environment,
or specify another positive value to use this environment with a
different spacing.
lspace
extra vertical scape, in character size units (i.e., "ex"
as appended to the space). When using certain font sizes, there is
too much space left around LaTeX verbatim environments. This
two-vector specifies space to remove (i.e., the values are negated in
forming the vspace
command) before (first element) and after
(second element of lspace
) verbatims
scroll
set to TRUE
to create an html scrollable box for
the html output
rows, cols
the number of rows or columns to allocate for the
scrollable box
vname
unused argument in latex.describe.single
. For html
is used to pass the current variable name
which
specifies whether to plot numeric continuous or
binary/categorical variables, or both. When "both"
a list with
two elements is created. Each element is a ggplot2
or
plotly
object. If
there are no variables of a given type, a single ggplot2
or
plotly
object is returned, ready to print.
what
character or numeric vector specifying which variables to
plot; default is to plot all
sort
specifies how and whether variables are sorted in order of
the proportion of positives when which="categorical"
. Specify
sort="none"
to leave variables in the order they appear in the
original data.
n.unique
the minimum number of distinct values a numeric variable
must have before plot.describe
uses it in a continuous variable
plot
condense
specifies whether to condense the output with regard to
the 5 lowest and highest values ("extremes"
) and the frequency table
lang
specifies the markup language
verb
set to 1 if a verbatim environment is already in effect for LaTeX