Skip to content

Commit

Permalink
Tweaks to documentation to pass R CMD check
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Jun 23, 2009
1 parent 0e69e45 commit 1f28d27
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 5 deletions.
2 changes: 1 addition & 1 deletion NEWS
@@ -1,4 +1,4 @@
plyr 0.1.9 (2008-XX-XX) ---------------------------------------------------
plyr 0.1.9 (2008-06-23) ---------------------------------------------------

* fix bug in rbind.fill when NULLs present in list
* improve each to recognise when all elements are numeric
Expand Down
8 changes: 5 additions & 3 deletions R/helper-summarise.r
Expand Up @@ -8,14 +8,16 @@
#
# @arguments The data frame to be summarised
# @arguments Further arguments of the form var = value
# @keyword manip
# @alias summarize
#X summarise(baseball,
#X duration = max(year) - min(year),
#X nteams = length(unique(team)))
#X ddply(baseball, "id", summarise,
#X duration = max(year) - min(year),
#X nteams = length(unique(team)))
summarize <- summarise <- function(`_data`, ...) {
eval(substitute(data.frame(...)), `_data`, parent.frame())
summarise <- function(.data, ...) {
eval(substitute(data.frame(...)), .data, parent.frame())
}

summarize <- summarise
# Alternative names: tally? sketch? abstract? abbreviate?
2 changes: 2 additions & 0 deletions R/quote.r
Expand Up @@ -87,6 +87,8 @@ eval.quoted <- function(exprs, envir = parent.frame(), enclos = if (is.list(env
# @alias as.quoted.character
# @alias as.quoted.formula
# @alias as.quoted.quoted
# @alias as.quoted.NULL
# @alias as.quoted.numeric
# @alias c.quoted
# @alais as.quoted.NULL
#X as.quoted(c("a", "b", "log(d)"))
Expand Down
3 changes: 3 additions & 0 deletions man/as-quoted-3f.rd
Expand Up @@ -4,6 +4,9 @@
\alias{as.quoted.character}
\alias{as.quoted.formula}
\alias{as.quoted.quoted}
\alias{as.quoted.NULL}
\alias{as.quoted.numeric}
\alias{c.quoted}
\title{Convert input to quoted variables}
\author{Hadley Wickham <h.wickham@gmail.com>}

Expand Down
11 changes: 10 additions & 1 deletion man/rbind-fill-di.rd
Expand Up @@ -20,5 +20,14 @@ bplayer <- split(baseball, baseball$id)
system.time(b1 <- do.call("rbind", bplayer))
rownames(b1) <- NULL
system.time(b2 <- rbind.fill(bplayer))
stopifnot(all.equal(b1, b2))}
stopifnot(all.equal(b1, b2))

a <- data.frame(a = factor(letters[1:3]), b = 1:3, c = date())
b <- data.frame(a = factor(letters[3:5]),
d = as.Date(c("2008-01-01", "2009-01-01", "2010-01-01")))
ab1 <- rbind.fill(a, b)[, letters[1:4]]
ab2 <- rbind.fill(b, a)[c(4:6, 1:3), letters[1:4]]
ab2$a <- factor(ab2$a, levels(ab1$a))
rownames(ab2) <- NULL
stopifnot(all.equal(ab1, ab2))}
\keyword{manip}
27 changes: 27 additions & 0 deletions man/summarise-n4.rd
@@ -0,0 +1,27 @@
\name{summarise}
\alias{summarise}
\alias{summarize}
\title{Summarise a data frame.}
\author{Hadley Wickham <h.wickham@gmail.com>}

\description{
Create a new data frame that summarises an existing data frame.
}
\usage{summarise(.data, ...)}
\arguments{
\item{.data}{The data frame to be summarised}
\item{...}{Further arguments of the form var = value}
}

\details{Summarise works in an analagous way to transform, except instead of adding
columns to an existing data frame, it creates a new one. This is
particularly useful in conjunction with \code{\link{ddply}} as it makes it
easy to perform group-wise summaries.}

\examples{summarise(baseball,
duration = max(year) - min(year),
nteams = length(unique(team)))
ddply(baseball, "id", summarise,
duration = max(year) - min(year),
nteams = length(unique(team)))}
\keyword{manip}

0 comments on commit 1f28d27

Please sign in to comment.