Skip to content
RDocumentation: count
Note that this notebook was automatically generated from an RDocumentation page. It depends on the package and the example code whether this code will run without errors. You may need to edit the code to make things work.
if(!require('plyr')) {
install.packages('plyr')
library('plyr')
}# Count of each value of "id" in the first 100 cases
table(baseball[1:100, "id"])
# Count of ids, weighted by their "g" loading
table(baseball[1:100, "id"], wt = baseball[1:100, "g"])
table(baseball, "id", "ab")
table(baseball, "lg")
# How many stints do players do?
table(baseball, "stint")
# Count of times each player appeared in each of the years they played
table(baseball[1:100, c("id", "year")])
# Count of counts
table(table(baseball[1:100, c("id", "year")]), "id", "freq")
table(table(baseball, c("id", "year")), "freq")