Tags:
create new tag
, view all tags, tagging instructions
-- SallyThurston - 12 Mar 2010

  • example.pdf: pdf file output from running summarize.example.R (which only saves the last example to a file)

MacroHeaderForm edit

Macro Name Summarize
Description Contains 2 functions: (1) lookup; (2) summarize. Summarize is the primary function

(1) lookup: returns the longname for the relevant part of a vector - point is to be able to work with short name when coding, but be able to use the longname in making plots or tables.

(2) summarize: give nicely formatted summary statistics of all columns in a dataframe. User has option to choose whether this is displayed by longnames (from lookup), what quantiles to show, whether to show results on screen, name of file (if want to save it to a file), and whether the output should be plain text or LaTeX?
Macro Parameters For (1) lookup: colname (column name of a dataframe), longnames (vector of longer variable names, where the name of longnames should include colname)

For (2) summarize:
### REQUIRED arguments are:
### tmat = dataframe containing variable for which we want a summary
### OPTIONAL arguments are:
### digits = number of digits to show in the summary
### quants = quantiles to be included. Default is c(0,.25,.5,.75,1)
### If don't want quantiles, make quants=NULL
### latex = TRUE if want output in LaTeX?
### full.latex = TRUE if want latex output to be a stand-alone
### LaTeX? file. If latex=TRUE and full.latex=FALSE, the
### output can be included with an \include{filename} command.
### (may be useful if output from this function will be
### included as one part of a larger set of function calls.)
### SD = TRUE if want to show SD
### nmis = TRUE if want to show number missing observations
### uniq = TRUE if want to show number of categories
### lookup.names = vector of longer variable names, where column names
### should match variable names in tmat
### filename = name of file where output should be saved
### (default is NULL, not to save it to a file)
### screen = TRUE if want to view results on the screen
### caption = caption for LaTeX? format
Programmer Sally Thurston
Revision 1
Disclaimer

Example(s) Examples are given in summarize.example.R. Here is a subset of examples:

## Default settings
summarize(airquality)

## Don't show quantiles, sbut show # missing and # unique values
summarize(airquality,nmis=TRUE,uniq=TRUE)

## Create a table to input into a LaTeX?? file, using defaults
## NOTE: make screen=FALSE if don't want to also display on screen
summarize(airquality,screen=TRUE,latex=TRUE,caption="Illustration of summarize using air quality data")
Special Features

Called Macros summarize.example.R calls on summarize and lookup that are both contained in summarize.R
Notes

See Also

Topic revision: r3 - 03 Jun 2011 - 16:18:01 - MaryBanach
 

Copyright & by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding CTSPedia? Send feedback