Skip to content
Prev 168276 / 398502 Next

problem with table()

on 01/26/2009 12:23 PM Dominik Hattrup wrote:
table() generates frequencies from individual values, not from already
tabulated data.

In this case, you can use xtabs():
year
name    2000 2002 2004
  Julia    3    4    1
  Peter    1    2    4


See ?xtabs

An alternative would be to use tapply():
year
name    2000 2002 2004
  Julia    3    4    1
  Peter    1    2    4


See ?tapply

HTH,

Marc Schwartz