In [8]:
head(warpbreaks)
Out[8]:
Ignoring the "breaks" attribute, let's make a contingency table of counts. We're using the GLM syntax to describe which columns we want, nothing explained "~" by the wool and tension variables.
In [15]:
ct = xtabs(~wool+tension, data=warpbreaks)
In [16]:
ct
Out[16]:
In [23]:
is.table(ct)
Out[23]:
We can also use the table function, which converts a dataframe into a tabke, and the margin.table function, which marginalizes a table, to accomplish this.
In [24]:
table(warpbreaks)
Out[24]:
In [30]:
margin.table(table(warpbreaks),c(2,3))
Out[30]:
In [ ]: