# Voting for the BBWAA Manager of the Year award by year and league
require(plyr)
# Sort in decreasing order of points by year and league
MOYsort <- ddply(AwardsShareManagers, .(yearID, lgID), arrange, desc(pointsWon))
# Any unanimous winners?
subset(AwardsShareManagers, pointsWon == pointsMax)
# OK, how about highest proportion of possible points?
AwardsShareManagers[with(AwardsShareManagers, which.max(pointsWon/pointsMax)), ]
# Bobby Cox's MOY vote tallies
subset(AwardsShareManagers, playerID == "coxbo01")
Run the code above in your browser using DataLab