Frequencies

With the plyr package, use the count() function (via).

This code computes the frequencies for each value that var can take:

count(df, var)

If you want to have the frequencies of the combination of all the values of two variables, use this:

count(df, var1, var2)

If R does not display all the rows, use this:

as.data.frame(count(df, var1, var2)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.