Create 'Table 1' to Describe Baseline Characteristics

Creates 'Table 1', i.e., description of baseline patient characteristics, which is essential in every medical research. Supports both continuous and categorical variables, as well as p-values and standardized mean differences. Weighted data are supported via the 'survey' package. See 'github' for a screen cast. 'tableone' was inspired by descriptive statistics functions in 'Deducer' , a Java-based GUI package by Ian Fellows. This package does not require GUI or Java, and intended for command-line users.



  • Fix the vignette for upcoming ggplot2 update.


  • Solve errors with abnormal pooled variance-covariance matrices in standardized mean difference calculation.


  • Solve problems with unit testing on the sparc architecture without extended-precision arithmetic support.

  • Fix title for second vignette.


  • Weighted data are now supported via the survey package. svydesign() should be used to create a survey design object, and this object should be used for svyCreateTableOne() instead of a data frame. Other options are essentially the same. All results will be weighted results.

  • Standardized mean differences are calculated. print() methods include smd option, which defaults to FALSE for backward compatibility. If TRUE, SMD is shown on the right side of the table. To suppress p-values, use test = FALSE option. summary() methods also print SMDs. If there are more than two strata, all possible pairwise contrasts are shown along with the average SMD across all contrats. In this case, print methods only prints the average SMD for brevity. For categorical variables Yang and Dalton's suggested method (A unified approach to measuring the effect size between two groups using SAS. SAS Paper 335-2012) is used. SMDs for weighted data are experimental.

  • ExtractSmd() function can be used to extract SMD values as a numeric matrix, which then can be used for plotting, etc.

  • An new RMarkdown vignette explains the use of standardized mean differences.

  • The includeNA option for CreateTableOne() and svyCreateTableOne() make NA's in factors treated as a regular level.

  • ShowRegTable() now has ciFun option, which allows use of the confint.default function if calculation is too slow for glm results.

  • print.TableOne() aligns the sample size with other summaries.


  • ShowRegTable() uses coef to refer to coefficients.

  • Unit tests were extended to cover more functions.

  • CreateTableOne() was refactored to avoid redundant calculation.

  • New dependencies: survey, MASS, and zoo


  • Fixed pDigits option in print.ContTable(), which was not correctly functional as advertised.


  • An RMarkdown vignette outlining the use of the package was added.


  • The testing of 1 x m table was problematic when a categorical variable only have one level. chisq.test() returns Chi-squared test for given probabilities (test for strata imbalance) in such cases. In this version, testing a 1 x m table always return NA, as test for a cross table is not defined in this context.

  • Special thanks to Atsushi Shiraishi for reporting this issues.

  • Unit testing with the testthat package was added for some functions. Thus, the testthat package was added as a suggested package.


  • The algorithm CreateCatTable used to detect variables to convert to factos had a bug. CreateCatTable was effectively (re-)converting all variables to factors, which deleted empty levels from factors and ordered factors.

  • Special thanks to Atsushi Shiraishi for reporting this issues.


  • The CreateTableOne function automatically use all variables in the data frame given to the data argument, if the vars argument is empty.
  • The printToggle argument added to ShowRegTable().


  • The noSpaces argument was added to print.* functions. This allows removal of spaces added for alignment using fixed-width fonts. Use this option if you prefer to align your table in other software. (Special thanks to Raja Sriswan Mamidi for suggestions)


  • The showAllLevels argument to show all levels of categorical variables regardless of numbers of levels was added to print.TableOne. Previously, it was only available in print.CatTable. To accommodate this feature, insertLevel argument to insert an empty level column was added to print.ContTable. (Special thanks to Yoshinobu Kanda for suggestions)


  • Fixed a problem with space insertion when empty strata are present.

  • Thanks Joris Muller for bug reports and code suggestions for the following.

  • Added more robust class assessment in CreateTableOne and CreateCatTable, which now handles ordered factors correctly. CreateTableOne also drops Surv object for safety.

  • "Dropped due to unsupported class" message has been fixed to show variable names with spaces in between.


  • Added the Create* functions handling of all NA/NaN variables. These invalid variables are examined at the beginning and dropped with warning for safety.

  • For the strata argument, variables with only one level is dropped with warning because these are meaningless, and caused data handling problems.


  • CreateTableOne now handles logical and chracter vectors correctly. They are handled as categorical variables, and passed to the CreateCatTable function. Variables that are none of numeric, integer, factor, logical, or character are dropped for safety.


  • DESCRIPTION changed for clarity. No functional changes.


  • NAMESPACE now includes import(e1071) and import(gmodels).

  • DESCRIPTION now includes Imports e1071, gmodels and Suggests survival, instead of Depends...


  • CreateTableOne has a new factorVars argument, a character vector specifying numerically coded variables that should be treated as factors.

  • The print method for the TableOne/CatTable class object has a new minMax argument, a logical value specifying whether to show median [min, max] instead of median [IQR] for nonnormal variables

  • The print method for the TableOne/CatTable class object has a new cramVars argument, a character vector to specify which 2-level factors to should have both levels presented in one row.


  • Documentations were fixed to represent the current version.


  • Documentations were fixed to represent the current version.


  • CreateTableOne and related print/summary methods were added.

  • CreateTableOne can crate a table with both categorical and continuous variables.

  • The print method can suppress printing by printToggle option.


  • In the Roxygen part of the code, only at_export followed by nothing is used.


  • Fixed incorrect specification of S3 method export.

  • To make an object an S3 method and export it both at_S3method and at_export tags are needed in the Roxygen part of the code.

  • Passed all the default tests by R CMD check file.tar.gz


  • This version is to better conform to the CRAN standards.

  • Documents are now included in


  • This is the first developmental version to be made public.

  • tableone makes creation of "Table 1", description of baseline characteristics common in medical research papers easy.


Reference manual

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


0.8.1 by Kazuki Yoshida, 3 months ago

Browse source code at

Authors: Kazuki Yoshida, Justin Bohn.

Documentation:   PDF Manual  

GPL-2 license

Imports survey, MASS, e1071, zoo, gmodels, nlme

Suggests survival, testthat, Matrix, dummies, Matching, reshape2, ggplot2, knitr, geepack, lme4

Suggested by RcmdrPlugin.EZR, rpsftm.

See at CRAN