if (require("Lahman")) {
batting_tbl <- tbl_df(Batting)
tally(group_by(batting_tbl, yearID))
plays_by_year <- tally(group_by(batting_tbl, playerID, stint))
tally(plays_by_year)
# FIXME: https://github.com/hadley/dplyr/issues/129
# tally(tally(plays_by_year))
tally(group_by(plays_by_year, stint))
# This looks a little nicer if you use the infix %.% operator
batting_tbl %.% group_by(playerID) %.% tally()
}
Run the code above in your browser using DataLab