DescTools (version 0.99.11)

DescWrd: Use Word as Reporting Tool for Describing Data

Description

Calculates descriptive statistics for x and uses Word as reporting tool.

Usage

## S3 method for class 'default':
DescWrd(x, wrd, main = deparse(substitute(x)), ...)

## S3 method for class 'data.frame':
DescWrd(x, wrd, main = NULL, enum = TRUE, \dots)

## S3 method for class 'list':
DescWrd(x, wrd, main = NULL, enum = TRUE, \dots)

## S3 method for class 'formula':
DescWrd(formula, data = parent.frame(), subset = TRUE, wrd, ...)

Arguments

x
the object to be described.
main
the title of the decription or a vector with the main titles for the description of the variables. If this is left blank, the title will be composed as: number - variablename (class(es)).
enum
logical, determining if the number should be included or not. Default is TRUE. The numbers may be redundant or inconsistent, if a Word report with enumerated headings is created.
wrd
the pointer to a word instance. Can be a new one, created by GetNewWrd() or an existing one, created by GetCurrWrd(). Default is the last created pointer stored in getOption("lastWord").
formula
a formula of the form lhs ~ rhs where lhs gives the data values and rhs the corresponding groups.
data
an optional matrix or data frame containing the variables in the formula formula. By default the variables are taken from environment(formula).
subset
an optional vector specifying a subset of observations to be used.
...
further argument to be passed to methods.

Details

This function is not thought of being directly run by the enduser. It will normally be called automatically, when a pointer to a Word instance is passed to the function Desc. However DescWrd takes some more specific arguments concerning the Word output (like font or fontsize), which can make it necessary to call the function directly.

See Also

Desc

Examples

Run this code
# Output into word document ---------------------------------------------------------

# Windows-specific example

wrd <- GetNewWrd(header=TRUE)    # create a new word instance and insert title and contents

# let's have a subset
d.sub <- d.pizza[,c("driver","date","operator","price","wrongpizza")]

# do just the univariate analysis
Desc(d.sub, wrd=wrd) 

# do a full report
Desc(d.sub, wrd=wrd, colpairs=TRUE)

# do just bivariate analysis
Desc( d.sub, univar=FALSE, colpairs=TRUE, wrd=wrd) 

# selected bivariate analysis into word document
Desc(week ~ driver, data=d.pizza, wrd=wrd)   
Desc(price ~ operator, data=d.pizza, digits=c(2,2,2,2,0,3,0,0), wrd=wrd ) 
Desc(driver ~ operator, data=d.pizza, wrd=wrd) 
Desc(price ~ operator + driver + wrongpizza, data=d.pizza
     , digits=c(2,2,2,2,0,3,0,0), wrd=wrd) 

Desc(price ~ delivery_min, data=d.pizza, wrd=wrd ) 


# internal functions (not meant to be used by the enduser):
Desc.factor(d.pizza$driver, ord="n" )  # ordered by name
Desc.factor(d.pizza$driver, ord="l" )  # ordered by level
Desc.logical(d.pizza$wrongpizza)
Desc.integer(d.pizza$weekday, maxlevels=NA)
Desc.integer(d.pizza$weekday, maxlevels=3)
Desc.numeric(d.pizza$count, highlow=FALSE)
Desc.numeric(d.pizza$count, highlow=TRUE)
 
DescNumFact( x=d.pizza$delivery_min, grp=d.pizza$operator )
DescFactFact( x=d.pizza$driver, grp=d.pizza$operator)
DescNumNum( x=d.pizza$delivery_min, y=d.pizza$price )

Run the code above in your browser using DataCamp Workspace