table() builds a frequency table from a factor or vector, counting how many rows each department has. The output is a named count per category, sorted by name. This is base R's quick category census, equivalent to xsv frequency. Pass two vectors to table() to build a cross-tabulation of combinations.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.