Descriptive Statistics

Weighted frequency and contingency tables of categorical variables and of the comparison of the mean value of a numerical variable by the levels of a factor, and methods to produce xtable objects of the tables and to plot them. There are also functions to facilitate the character encoding conversion of objects, to quickly convert fixed width files into csv ones, and to export a data.frame to a text file with the necessary R and SPSS codes to reread the data.

This is the development version of the R package 'descr'.


Version 1.1.4 (2018-01-18)

  • Minor bug fixes.

Version 1.1.3 (2016-05-11)

  • Minor bug fixes.

Version 1.1.2 (2015-08-02)

  • New arguments for CrossTable and crosstab: row.labels, percent, total.c and total.r.

  • Turn digits argument of CrossTable into a list.

  • Improve label abbreviation algorithm for very wide cross tables.

  • Fix import notes during R CMD check --as-cran.

Version 1.1.1 (2015-05-06)

  • Bug fixes in forODFTable() and xtable.CrossTable().

Version 1.1 (2015-04-13)


- The plot.CrossTable() function now plots a mosaic graphic with rows and
  columns that mirror the output table. The x and y arguments of
  crosstab() were renamed indep and dep, respectively, to avoid the
  confusion with what should be xlab and ylab. The arguments
  user.missing.x and user.missing.y were also renamed.

Bug fix:

- Use format.pval() to print p-value in print.CrossTable().

Version 1.0.4 (2014-11-04)

Bug fixes:

- R/labels2R.R: Accept negative values.

- R/xtable.R: Add row and column total proportions to xtable (thanks to
  Johannes Herrmann for reporting the bug).


- New argument for compmeans: missing.include (thanks to Olivier Armand
  for reporting the issue that led to this change).

- New argument for CrossTable: drop.levels.

- New option:

Version 1.0.3 (2014-08-01)

Bug fixes:

- R/labels2R.R: Avoid infinite loop.

- R/xtable.R: Avoid errors when either sresid or prop.chisq are TRUE.

- src/descr.c: Read up to 32765 characters from input lines.

Version 1.0.2 (2013-11-01)

Bug fixes:

- R/xtable.R: Fix column name "Total" and deal with "$" in label names.

- Allow to change the values of xlim and ylim in histkdnc(). Thanks to
  Thomas W. MacFarland for reporting the bug.


- Make CrossTable() to print residuals even if format="SAS".

- Make CrossTable() to print only what is set to TRUE.

- CrossTable() doesn't output chisq.test() warnings if chisq = FALSE and
  prop.chisq = FALSE.

- News functions: data.frame2txt() and labels2R().

Version 1.0.1 (2013-01-15)

Bug fix:

- src/fwf2csv.c: Free no longer used allocated memory.

- Implement weighted boxplot for compmeans (code written by Stefan Kraft
  for the simPopulation package).


- Add option to suppress warnings: "descr.warn".

Version 1.0.0 (2012-11-18)

Bug fix:

- src/fwf2csv.c: Don't cause stack smashing if field is wider than 255
  characters (thanks to Anthony Damico for reporting the bug).

Version 0.9.9 (2012-09-24)

Bug fix:

- Sort boxplots widths in compmeans if sort = TRUE.

Version 0.9.8 (2012-08-06)


- New argument for CrossTable(): cell.layout.

- No longer produce weighted box plots.

Version 0.9.7 (2011-12-12)


- Boxplot made by compmeans now have relative widths and the boxes have
  gray color.

- Adapt the width of cross tables to options("width").

Bug fix:

- CrossTable, crosstab and compmeans: Correctly calculate widths if the
  text is in Chinese (thanks to Wincent Ronggui Huang for reporting the

- print.CrossTable() and xtable.CrossTable(): handle the argument dnn,
  which was being ignored.

Version 0.4.2 (2011-11-24)


- Replace method odfTable.CrossTable with function forODFTable to avoid
  dependency on odfWeave which currently is not installable on Windows.

Bug fix:

- CrossTable(): Improve documentation about default values of chisq,
  resid, sresid, and asresid. Set the value of expected to TRUE if
  residuals are requested (thanks for David Carlson for reporting the

Version 0.4.1 (2011-09-06)

Bug fix:

- file.head(): Does not fail if file encoding is Latin1 or other single
               byte encoding and system encoding is UTF-8 (thanks to
               Sergio Martins for reporting the bug).

Version 0.4.0 (2011-06-25)


- odfTable method for object of class CrossTable.

- Improved xtable method for object of class CrossTable.

Version 0.3.4 (2011-04-24)


- Objects of classes meanscomp, freqtable and CrossTable now have
  plot methods.

Version 0.3.3 (2011-02-08)


- compmeans(): When sort=T the boxplots are sorted too.
               Uses wtd.boxplot of package NEmisc.
               Returns a matrix instead of a list.

- freq(): Returns a matrix instead of a list.

- Changed the dependency of xtable from Depends to Imports.

- fwf2csv: Only prints message about number of lines saved 
  if the value of "verbose" option is TRUE.

New features:

- Added argument user.missing to freq(), compmeans(), and crosstab().

Version 0.3.2 (2009-10-11)

Bug fixes:

- Fixed documentation link to read.fwf().

- Added domain = "R-descr" to all gettext().

- Fixed conversion of fwf into csv when the fwf had \r\n line terminators
  and R was running on Linux. Also fixed reading of strings with spaces.


- Inverted colors in the mosaic plot produced by crosstab().

- Only add cumulative percent to frequency table if the object is "ordered".

- print.CrossTable():
    - Removed the message "Total Observations in Table", since the number is
      printed in the table anyway.
    - Removed vertical bars from the output to give room for longer
      factor labels.
    - getOption("OutDec") now is used to format the numbers.
    - Expected frequency now is always printed with one decimal digit.

New features:

- Added function file.head(), which shows the first lines of a file (useful
  before read.table()).

Version 0.3.1 (2009-08-11)

New features:

- Included a version of CrossTable, adapted from gmodels package, with
  methods for print and xtable.

- Added xtable methods for classes freqtable and meanscomp.

Version 0.3.0 (2009-06-07)

New features:

- Added plot option to crosstab, compmeans and freq.

- Renamed function crosstabs to crosstab.

- LogRegR2 now accepts "probit" models.

Bug fixes:

- Fixed bug in the weighted standard deviation calculus in compmeans.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.1.5 by Jakson Aquino, 7 months ago

Browse source code at

Authors: Jakson Aquino. Includes R source code and/or documentation written by Dirk Enzmann , Marc Schwartz , Nitin Jain , and Stefan Kraft

Documentation:   PDF Manual  

GPL (>= 2) license

Imports xtable, utils, grDevices, graphics, stats

Imported by poliscidata.

Suggested by RDIDQ, pander, rattle.

See at CRAN