if (require("Lahman")) {
players <- group_by(tbl_df(Batting), playerID)
games <- tally(players, G)
top_n(games, 10, n)
# A little nicer with %.%
tbl_df(Batting) %.% group_by(playerID) %.% tally(G) %.% top_n(10)
}
Run the code above in your browser using DataLab