6. Tables

  1. Michael J. Crawley

Published Online: 6 NOV 2012

DOI: 10.1002/9781118448908.ch6

The R Book, Second Edition

The R Book, Second Edition

How to Cite

Crawley, M. J. (2012) Tables, in The R Book, Second Edition, John Wiley & Sons, Ltd, Chichester, UK. doi: 10.1002/9781118448908.ch6

Author Information

  1. Imperial College London at Silwood Park, UK

Publication History

  1. Published Online: 6 NOV 2012
  2. Published Print: 7 DEC 2012

ISBN Information

Print ISBN: 9780470973929

Online ISBN: 9781118448908



  • tables;
  • tables of counts;
  • summary tables;
  • expanding a table into a dataframe;
  • dataframe to a table, conversion;
  • prop.table, and calculating tables of proportions;
  • the scale function;
  • the expand.grid function;
  • the model.matrix function;
  • comparing table and tabulate


This chapter contains sections titled:

  • Tables of counts

  • Summary tables

  • Expanding a table into a dataframe

  • Converting from a dataframe to a table

  • Calculating tables of proportions with prop.table

  • The scale function

  • The expand.grid function

  • The model.matrix function

  • Comparing table and tabulate