Browse files

Documentation improvements

  • Loading branch information...
1 parent 9b9a52f commit e3bd46f19cce19b68a90d0b9db82d28b04ab8fec @hadley committed Jul 13, 2011
View
9 R/helper-each.r
@@ -1,11 +1,10 @@
#' Aggregate multiple functions into a single function.
#'
-#' Combine multiple functions to a single function returning a named vector of
-#' outputs
+#' Combine multiple functions into a single function returning a named vector
+#' of outputs.
#'
-#' Each function should produce a single number as output
-#'
-#' @param ... functions to combine
+#' @param ... functions to combine. each function should produce a single
+#' number as output
#' @keywords manip
#' @export
#' @examples
View
4 R/progress.r
@@ -50,6 +50,7 @@ create_progress_bar <- function(name = "none", ...) {
#' understand - it does nothing!
#'
#' @keywords internal
+#' @family progress bars
#' @export
#' @examples
#' l_ply(1:100, identity, .progress = "none")
@@ -71,6 +72,7 @@ progress_none <- function() {
#'
#' @param style style of text bar, see Details section of \code{\link{txtProgressBar}}
#' @param ... other arugments passed on to \code{\link{txtProgressBar}}
+#' @family progress bars
#' @export
#' @examples
#' l_ply(1:100, identity, .progress = "text")
@@ -102,6 +104,7 @@ progress_text <- function(style = 3, ...) {
#' @param label progress bar label (inside window)
#' @param ... other arguments passed on to \code{\link[tcltk]{tkProgressBar}}
#' @seealso \code{\link[tcltk]{tkProgressBar}} for the function that powers this progress bar
+#' @family progress bars
#' @export
#' @examples
#' l_ply(1:100, identity, .progress = "tk")
@@ -135,6 +138,7 @@ progress_tk <- function(title = "plyr progress", label = "Working...", ...) {
#' @param ... other arguments passed on to \code{winProgressBar}
#' @seealso \code{winProgressBar} for the function that powers this progress bar
#' @export
+#' @family progress bars
#' @examples
#' if(exists("winProgressBar")) {
#' l_ply(1:100, identity, .progress = "win")
View
34 R/quote.r
@@ -113,40 +113,35 @@ eval.quoted <- function(exprs, envir = NULL, enclos = NULL, try = FALSE) {
#'
#' @return a list of quoted variables
#' @seealso \code{\link{.}}
-#' @aliases as.quoted.call as.quoted.character as.quoted.formula
-#' as.quoted.quoted as.quoted.NULL as.quoted.numeric c.quoted as.quoted
-#' [.quoted
#' @param x input to quote
#' @param env environment in which unbound symbols in expression should be
#' evaluated. Defaults to the environment in which \code{as.quoted} was
#' executed.
-#' @S3method as.quoted call
-#' @S3method as.quoted character
-#' @S3method as.quoted factor
-#' @S3method as.quoted formula
-#' @S3method as.quoted quoted
-#' @S3method as.quoted name
-#' @S3method as.quoted NULL
-#' @S3method as.quoted numeric
-#' @S3method [ quoted
-#' @S3method c quoted
+#' @export
#' @examples
#' as.quoted(c("a", "b", "log(d)"))
#' as.quoted(a ~ b + log(d))
-#' @export
as.quoted <- function(x, env = parent.frame()) UseMethod("as.quoted")
+
+#' @S3method as.quoted call
as.quoted.call <- function(x, env = parent.frame()) {
structure(as.list(x)[-1], env = env, class = "quoted")
}
+
+#' @S3method as.quoted character
as.quoted.character <- function(x, env = parent.frame()) {
structure(
lapply(x, function(x) parse(text = x)[[1]]),
env = env, class = "quoted"
)
}
+
+#' @S3method as.quoted numeric
as.quoted.numeric <- function(x, env = parent.frame()) {
structure(x, env = env, class = c("quoted", "numeric"))
}
+
+#' @S3method as.quoted formula
as.quoted.formula <- function(x, env = parent.frame()) {
simplify <- function(x) {
if (length(x) == 2 && x[[1]] == as.name("~")) {
@@ -166,21 +161,32 @@ as.quoted.formula <- function(x, env = parent.frame()) {
structure(simplify(x), env = env, class = "quoted")
}
+
+#' @S3method as.quoted quoted
as.quoted.quoted <- function(x, env = parent.frame()) x
+
+#' @S3method as.quoted NULL
as.quoted.NULL <- function(x, env = parent.frame()) {
structure(list(), env = env, class = "quoted")
}
+
+#' @S3method as.quoted name
as.quoted.name <- function(x, env = parent.frame()) {
structure(list(x), env = env, class = "quoted")
}
+
+#' @S3method as.quoted factor
as.quoted.factor <- function(x, env = parent.frame()) {
as.quoted(as.character(x), env)
}
+
+#' @S3method c quoted
c.quoted <- function(..., recursive = FALSE) {
structure(NextMethod("c"), class = "quoted",
env = attr(list(...)[[1]], "env"))
}
+#' @S3method [ quoted
"[.quoted" <- function(x, i, ...) {
structure(NextMethod("["), env = attr(x, "env"), class = "quoted")
}
View
1 R/rbind-matrix.r
@@ -21,6 +21,7 @@
#' @author C. Beleites
#' @seealso \code{\link[base]{rbind}}, \code{\link[base]{cbind}},
#' \code{\link[plyr]{rbind.fill}}
+#' @family binding functions
#' @export
#' @keywords manip
#' @examples
View
1 R/rbind.r
@@ -12,6 +12,7 @@
#'
#' @param ... input data frames to row bind together
#' @keywords manip
+#' @family binding functions
#' @return a single data frame
#' @export
#' @examples
View
1 R/simplify-array.r
@@ -5,6 +5,7 @@
#' @param res list of input data
#' @param labels a data frame of labels, one row for each element of res
#' @param .drop should extra dimensions be dropped (TRUE) or preserved (FALSE)
+#' @family list simplification functions
#' @keywords internal
list_to_array <- function(res, labels = NULL, .drop = FALSE) {
if (length(res) == 0) return(vector())
View
2 R/simplify-data-frame.r
@@ -4,7 +4,7 @@
#' All \code{NULL} entries are removed. Remaining entries must be all atomic
#' or all data frames.
#'
-#'
+#' @family list simplification functions
#' @param res list of input data
#' @param labels a data frame of labels, one row for each element of res
#' @keywords internal
View
1 R/simplify-vector.r
@@ -4,6 +4,7 @@
#'
#' @param res list of input data
#' @keywords internal
+#' @family list simplification functions
list_to_vector <- function(res) {
n <- length(res)
if (n == 0) return(vector())
View
1 R/split-array.r
@@ -20,6 +20,7 @@
#' (expand = FALSE), with an element for each row; or nd (expand = TRUE),
#' with a dimension for each variable.
#' @return a list of lower-d slices, with attributes that record split details
+#' @family splitter functions
#' @keywords internal
#' @examples
#' plyr:::splitter_a(mtcars, 1)
View
1 R/split-data-frame.r
@@ -13,6 +13,7 @@
#' other operations.
#'
#' @seealso \code{\link{.}} for quoting variables, \code{\link{split}}
+#' @family splitter functions
#' @param data data frame
#' @param .variables a \link{quoted} list of variables
#' @param drop drop unnused factor levels?
View
8 man/as.quoted.Rd
@@ -1,13 +1,5 @@
\name{as.quoted}
-\alias{"[.quoted"}
\alias{as.quoted}
-\alias{as.quoted.call}
-\alias{as.quoted.character}
-\alias{as.quoted.formula}
-\alias{as.quoted.NULL}
-\alias{as.quoted.numeric}
-\alias{as.quoted.quoted}
-\alias{c.quoted}
\title{Convert input to quoted variables.}
\usage{
as.quoted(x, env = parent.frame())
View
10 man/each.Rd
@@ -5,14 +5,12 @@
each(...)
}
\arguments{
- \item{...}{functions to combine}
+ \item{...}{functions to combine. each function should
+ produce a single number as output}
}
\description{
- Combine multiple functions to a single function returning
- a named vector of outputs
-}
-\details{
- Each function should produce a single number as output
+ Combine multiple functions into a single function
+ returning a named vector of outputs.
}
\examples{
each(min, max)(1:10)
View
5 man/list_to_array.Rd
@@ -16,5 +16,10 @@
\description{
Reduce/simplify a list of homogenous objects to an array
}
+\seealso{
+ Other list simplification functions:
+ \code{\link{list_to_dataframe}},
+ \code{\link{list_to_vector}}
+}
\keyword{internal}
View
4 man/list_to_dataframe.Rd
@@ -15,5 +15,9 @@
frame. All \code{NULL} entries are removed. Remaining
entries must be all atomic or all data frames.
}
+\seealso{
+ Other list simplification functions:
+ \code{\link{list_to_array}}, \code{\link{list_to_vector}}
+}
\keyword{internal}
View
5 man/list_to_vector.Rd
@@ -10,5 +10,10 @@
\description{
Reduce/simplify a list of homogenous objects to a vector
}
+\seealso{
+ Other list simplification functions:
+ \code{\link{list_to_array}},
+ \code{\link{list_to_dataframe}}
+}
\keyword{internal}
View
4 man/progress_none.Rd
@@ -11,5 +11,9 @@
\examples{
l_ply(1:100, identity, .progress = "none")
}
+\seealso{
+ Other progress bars: \code{\link{progress_text}},
+ \code{\link{progress_tk}}, \code{\link{progress_win}}
+}
\keyword{internal}
View
4 man/progress_text.Rd
@@ -24,4 +24,8 @@
l_ply(1:100, identity, .progress = "text")
l_ply(1:100, identity, .progress = progress_text(char = "-"))
}
+\seealso{
+ Other progress bars: \code{\link{progress_none}},
+ \code{\link{progress_tk}}, \code{\link{progress_win}}
+}
View
3 man/progress_tk.Rd
@@ -27,5 +27,8 @@ l_ply(1:100, identity, .progress = progress_tk(label=""))
\seealso{
\code{\link[tcltk]{tkProgressBar}} for the function that
powers this progress bar
+
+ Other progress bars: \code{\link{progress_none}},
+ \code{\link{progress_text}}, \code{\link{progress_win}}
}
View
3 man/progress_win.Rd
@@ -25,5 +25,8 @@ l_ply(1:100, identity, .progress = progress_win(title="Working..."))
\seealso{
\code{winProgressBar} for the function that powers this
progress bar
+
+ Other progress bars: \code{\link{progress_none}},
+ \code{\link{progress_text}}, \code{\link{progress_tk}}
}
View
3 man/rbind.fill.Rd
@@ -27,5 +27,8 @@
\examples{
rbind.fill(mtcars[c("mpg", "wt")], mtcars[c("wt", "cyl")])
}
+\seealso{
+ Other binding functions: \code{\link{rbind.fill.matrix}}
+}
\keyword{manip}
View
2 man/rbind.fill.matrix.Rd
@@ -50,6 +50,8 @@ rbind.fill.matrix (A, 99)
\seealso{
\code{\link[base]{rbind}}, \code{\link[base]{cbind}},
\code{\link[plyr]{rbind.fill}}
+
+ Other binding functions: \code{\link{rbind.fill}}
}
\keyword{manip}
View
3 man/splitter_a.Rd
@@ -45,5 +45,8 @@ plyr:::splitter_a(ozone, 2)
plyr:::splitter_a(ozone, 3)
plyr:::splitter_a(ozone, 1:2)
}
+\seealso{
+ Other splitter functions: \code{\link{splitter_d}}
+}
\keyword{internal}
View
2 man/splitter_d.Rd
@@ -49,6 +49,8 @@ plyr:::splitter_d(mtcars, .(cyl3, vs), drop = FALSE)
\seealso{
\code{\link{.}} for quoting variables,
\code{\link{split}}
+
+ Other splitter functions: \code{\link{splitter_a}}
}
\keyword{internal}

0 comments on commit e3bd46f

Please sign in to comment.