forked from tidyverse/dplyr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename count to tally to avoid conflict with plyr
- Loading branch information
Showing
4 changed files
with
53 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
\name{tally} | ||
\alias{tally} | ||
\title{Tally observations by group.} | ||
\usage{ | ||
tally(x, wt) | ||
} | ||
\arguments{ | ||
\item{a}{\code{\link{tbl}} to tally} | ||
|
||
\item{wt}{if not specified, will tally the number of | ||
rows. If specified, will perform a "weighted" tally but | ||
summing over the specified variable.} | ||
} | ||
\description{ | ||
\code{tally} is a convenient wrapper for summarise that | ||
either call \code{\link{n}} or \code{\link{sum}(n)} | ||
depending on whether you're tallying for the first time, or | ||
re-tallying. | ||
} | ||
\examples{ | ||
if (require("Lahman")) { | ||
batting_tbl <- tbl_cpp(Batting) | ||
tally(group_by(batting_tbl, yearID)) | ||
plays_by_year <- tally(group_by(batting_tbl, playerID, stint)) | ||
tally(plays_by_year) | ||
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() | ||
} | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters