Permalink
Browse files

Update docs

  • Loading branch information...
1 parent 248641d commit 875df502d17049460cbc95bb5743450838060448 @hadley committed Jul 1, 2011
Showing with 1,443 additions and 864 deletions.
  1. +1 −1 NAMESPACE
  2. +1 −1 R/quote.r
  3. +32 −17 man/a_ply.Rd
  4. +47 −24 man/aaply.Rd
  5. +35 −19 man/adply.Rd
  6. +42 −24 man/alply.Rd
  7. +7 −5 man/amv_dim.Rd
  8. +7 −6 man/amv_dimnames.Rd
  9. +14 −10 man/arrange.Rd
  10. +15 −9 man/as.data.frame.function.Rd
  11. +8 −5 man/as.list.split.Rd
  12. +28 −20 man/as.quoted.Rd
  13. +20 −15 man/colwise.Rd
  14. +7 −5 man/compact.Rd
  15. +20 −13 man/count.Rd
  16. +18 −10 man/create_progress_bar.Rd
  17. +25 −14 man/d_ply.Rd
  18. +40 −21 man/daply.Rd
  19. +40 −24 man/ddply.Rd
  20. +8 −5 man/defaults.Rd
  21. +12 −9 man/desc.Rd
  22. +7 −5 man/dims.Rd
  23. +39 −21 man/dlply.Rd
  24. +12 −9 man/each.Rd
  25. +7 −5 man/empty.Rd
  26. +13 −7 man/eval.quoted.Rd
  27. +21 −12 man/failwith.Rd
  28. +9 −7 man/get-split.Rd
  29. +17 −11 man/id.Rd
  30. +4 −2 man/id_var.Rd
  31. +14 −9 man/idata.frame.Rd
  32. +12 −9 man/indexed_array.Rd
  33. +16 −11 man/indexed_df.Rd
  34. +12 −8 man/is.discrete.Rd
  35. +4 −2 man/is.formula.Rd
  36. +4 −2 man/isplit2.Rd
  37. +23 −15 man/join.Rd
  38. +10 −6 man/join.keys.Rd
  39. +22 −13 man/l_ply.Rd
  40. +36 −19 man/laply.Rd
  41. +25 −15 man/ldply.Rd
  42. +15 −10 man/liply.Rd
  43. +12 −6 man/list_to_array.Rd
  44. +9 −5 man/list_to_dataframe.Rd
  45. +7 −5 man/list_to_vector.Rd
  46. +34 −21 man/llply.Rd
  47. +10 −6 man/loop_apply.Rd
  48. +24 −14 man/m_ply.Rd
  49. +37 −20 man/maply.Rd
  50. +21 −11 man/match_df.Rd
  51. +35 −20 man/mdply.Rd
  52. +35 −20 man/mlply.Rd
  53. +20 −12 man/mutate.Rd
  54. +4 −2 man/names.quoted.Rd
  55. +7 −5 man/nunique.Rd
  56. +4 −2 man/print.quoted.Rd
  57. +8 −5 man/print.split.Rd
  58. +4 −3 man/progress_none.Rd
  59. +13 −7 man/progress_text.Rd
  60. +20 −11 man/progress_tk.Rd
  61. +17 −9 man/progress_win.Rd
  62. +7 −6 man/quickdf.Rd
  63. +23 −15 man/quoted.Rd
  64. +24 −14 man/r_ply.Rd
  65. +30 −15 man/raply.Rd
  66. +13 −8 man/rbind.fill.Rd
  67. +22 −13 man/rbind.fill.matrix.Rd
  68. +24 −14 man/rdply.Rd
  69. +7 −5 man/reduce_dim.Rd
  70. +13 −8 man/rename.Rd
  71. +23 −13 man/rlply.Rd
  72. +15 −9 man/round_any.Rd
  73. +14 −9 man/splat.Rd
  74. +10 −6 man/split_indices.Rd
  75. +10 −6 man/split_labels.Rd
  76. +24 −13 man/splitter_a.Rd
  77. +23 −12 man/splitter_d.Rd
  78. +10 −7 man/strip_splits.Rd
  79. +18 −14 man/summarise.Rd
  80. +13 −7 man/true.Rd
  81. +16 −10 man/try_default.Rd
  82. +4 −2 man/tryapply.Rd
  83. +7 −5 man/unrowname.Rd
  84. +23 −14 man/vaggregate.Rd
View
2 NAMESPACE
@@ -68,7 +68,7 @@ importFrom(stats,setNames)
S3method("[",idf)
S3method("[",quoted)
S3method("[[",idf)
-S3method(as.data.frame,function)
+S3method(as.data.frame,"function")
S3method(as.data.frame,idf)
S3method(as.quoted,"NULL")
S3method(as.quoted,call)
View
2 R/quote.r
@@ -21,7 +21,7 @@
#' @return list of symbol and language primitives
#' @aliases . quoted is.quoted
#' @export . is.quoted
-#' @name quoted
+#' @rdname quoted
#' @examples
#' .(a, b, c)
#' .(first = a, second = b, third = c)
View
49 man/a_ply.Rd
@@ -1,15 +1,38 @@
\name{a_ply}
\alias{a_ply}
\title{Split array, apply function, and discard results.}
-\usage{a_ply(.data, .margins, .fun = NULL, ..., .expand = TRUE,
- .progress = "none", .print = FALSE)}
+\usage{
+ a_ply(.data, .margins, .fun = NULL, ..., .expand = TRUE,
+ .progress = "none", .print = FALSE)
+}
+\arguments{
+ \item{.data}{matrix, array or data frame to be processed}
+
+ \item{.margins}{a vector giving the subscripts to split
+ up \code{data} by. 1 splits up by rows, 2 by columns and
+ c(1,2) by rows and columns, and so on for higher
+ dimensions}
+
+ \item{.fun}{function to apply to each piece}
+
+ \item{...}{other arguments passed on to \code{.fun}}
+
+ \item{.expand}{if \code{.data} is a data frame, should
+ output be 1d (expand = FALSE), with an element for each
+ row; or nd (expand = TRUE), with a dimension for each
+ variable.}
+
+ \item{.progress}{name of the progress bar to use, see
+ \code{\link{create_progress_bar}}}
+ \item{.print}{automatically print each result? (default:
+ \code{FALSE})}
+}
\description{
Split array, apply function, and discard results. For
each slice of an array, apply function and discard
results
}
-
\details{
All plyr functions use the same split-apply-combine
strategy: they split the input into simpler pieces, apply
@@ -20,18 +43,10 @@
you are calling purely for their side effects like
display plots and saving output.
}
-\keyword{manip}
-\references{Hadley Wickham (2011). The Split-Apply-Combine Strategy for
-Data Analysis. Journal of Statistical Software, 40(1), 1-29.
-\url{http://www.jstatsoft.org/v40/i01/}.}
-\arguments{
- \item{.data}{matrix, array or data frame to be processed}
- \item{.margins}{a vector giving the subscripts to split up \code{data} by. 1 splits up by rows, 2 by columns and c(1,2) by rows and columns, and so on for higher dimensions}
- \item{.fun}{function to apply to each piece}
- \item{...}{other arguments passed on to \code{.fun}}
- \item{.expand}{if \code{.data} is a data frame, should output be 1d
-(expand = FALSE), with an element for each row; or nd (expand = TRUE),
-with a dimension for each variable.}
- \item{.progress}{name of the progress bar to use, see \code{\link{create_progress_bar}}}
- \item{.print}{automatically print each result? (default: \code{FALSE})}
+\references{
+ Hadley Wickham (2011). The Split-Apply-Combine Strategy
+ for Data Analysis. Journal of Statistical Software,
+ 40(1), 1-29. \url{http://www.jstatsoft.org/v40/i01/}.
}
+\keyword{manip}
+
View
71 man/aaply.Rd
@@ -1,15 +1,47 @@
\name{aaply}
\alias{aaply}
\title{Split array, apply function, and return results in an array.}
-\usage{aaply(.data, .margins, .fun = NULL, ..., .expand = TRUE,
- .progress = "none", .drop = TRUE, .parallel = FALSE)}
+\usage{
+ aaply(.data, .margins, .fun = NULL, ..., .expand = TRUE,
+ .progress = "none", .drop = TRUE, .parallel = FALSE)
+}
+\arguments{
+ \item{.data}{matrix, array or data frame to be processed}
+
+ \item{.margins}{a vector giving the subscripts to split
+ up \code{data} by. 1 splits up by rows, 2 by columns and
+ c(1,2) by rows and columns, and so on for higher
+ dimensions}
+
+ \item{.fun}{function to apply to each piece}
+ \item{...}{other arguments passed on to \code{.fun}}
+
+ \item{.expand}{if \code{.data} is a data frame, should
+ output be 1d (expand = FALSE), with an element for each
+ row; or nd (expand = TRUE), with a dimension for each
+ variable.}
+
+ \item{.progress}{name of the progress bar to use, see
+ \code{\link{create_progress_bar}}}
+
+ \item{.drop}{should extra dimensions of length 1 be
+ dropped, simplifying the output. Defaults to
+ \code{TRUE}}
+
+ \item{.parallel}{if \code{TRUE}, apply function in
+ parallel, using parallel backend provided by foreach}
+}
+\value{
+ if results are atomic with same type and dimensionality,
+ a vector, matrix or array; otherwise, a list-array (a
+ list with dimensions)
+}
\description{
Split array, apply function, and return results in an
array. For each slice of an array, apply function then
combine results into an array
}
-
\details{
All plyr functions use the same split-apply-combine
strategy: they split the input into simpler pieces, apply
@@ -28,32 +60,15 @@
so that \code{apply(input, X, identity)} is equivalent to
\code{aperm(input, X)}.
}
-\keyword{manip}
-\value{if results are atomic with same type and dimensionality, a vector, matrix or array; otherwise, a list-array (a list with dimensions)}
-\references{Hadley Wickham (2011). The Split-Apply-Combine Strategy for
-Data Analysis. Journal of Statistical Software, 40(1), 1-29.
-\url{http://www.jstatsoft.org/v40/i01/}.}
-\arguments{
- \item{.data}{matrix, array or data frame to be processed}
- \item{.margins}{a vector giving the subscripts to split up \code{data} by. 1 splits up by rows, 2 by columns and c(1,2) by rows and columns, and so on for higher dimensions}
- \item{.fun}{function to apply to each piece}
- \item{...}{other arguments passed on to \code{.fun}}
- \item{.expand}{if \code{.data} is a data frame, should output be 1d
-(expand = FALSE), with an element for each row; or nd (expand = TRUE),
-with a dimension for each variable.}
- \item{.progress}{name of the progress bar to use, see \code{\link{create_progress_bar}}}
- \item{.drop}{should extra dimensions of length 1 be dropped, simplifying the output. Defaults to \code{TRUE}}
- \item{.parallel}{if \code{TRUE}, apply function in parallel, using parallel
-backend provided by foreach}
-}
-\examples{dim(ozone)
+\examples{
+dim(ozone)
aaply(ozone, 1, mean)
aaply(ozone, 1, mean, .drop = FALSE)
aaply(ozone, 3, mean)
aaply(ozone, c(1,2), mean)
dim(aaply(ozone, c(1,2), mean))
-dim(aaply(ozone, c(1,2), mean, .drop = FALSE))
+dim(aaply(ozone, c(1,2), mean, .drop = FALSE))
aaply(ozone, 1, each(min, max))
aaply(ozone, 3, each(min, max))
@@ -62,4 +77,12 @@ standardise <- function(x) (x - min(x)) / (max(x) - min(x))
aaply(ozone, 3, standardise)
aaply(ozone, 1:2, standardise)
-aaply(ozone, 1:2, diff)}
+aaply(ozone, 1:2, diff)
+}
+\references{
+ Hadley Wickham (2011). The Split-Apply-Combine Strategy
+ for Data Analysis. Journal of Statistical Software,
+ 40(1), 1-29. \url{http://www.jstatsoft.org/v40/i01/}.
+}
+\keyword{manip}
+
View
54 man/adply.Rd
@@ -1,15 +1,41 @@
\name{adply}
\alias{adply}
\title{Split array, apply function, and return results in a data frame.}
-\usage{adply(.data, .margins, .fun = NULL, ..., .expand = TRUE,
- .progress = "none", .parallel = FALSE)}
+\usage{
+ adply(.data, .margins, .fun = NULL, ..., .expand = TRUE,
+ .progress = "none", .parallel = FALSE)
+}
+\arguments{
+ \item{.data}{matrix, array or data frame to be processed}
+
+ \item{.margins}{a vector giving the subscripts to split
+ up \code{data} by. 1 splits up by rows, 2 by columns and
+ c(1,2) by rows and columns, and so on for higher
+ dimensions}
+
+ \item{.fun}{function to apply to each piece}
+
+ \item{...}{other arguments passed on to \code{.fun}}
+
+ \item{.expand}{if \code{.data} is a data frame, should
+ output be 1d (expand = FALSE), with an element for each
+ row; or nd (expand = TRUE), with a dimension for each
+ variable.}
+
+ \item{.progress}{name of the progress bar to use, see
+ \code{\link{create_progress_bar}}}
+ \item{.parallel}{if \code{TRUE}, apply function in
+ parallel, using parallel backend provided by foreach}
+}
+\value{
+ a data frame
+}
\description{
Split array, apply function, and return results in a data
frame. For each slice of an array, apply function then
combine results into a data frame
}
-
\details{
All plyr functions use the same split-apply-combine
strategy: they split the input into simpler pieces, apply
@@ -20,20 +46,10 @@
results, then this function will return a data frame with
zero rows and columns (\code{data.frame()}).
}
-\keyword{manip}
-\value{a data frame}
-\references{Hadley Wickham (2011). The Split-Apply-Combine Strategy for
-Data Analysis. Journal of Statistical Software, 40(1), 1-29.
-\url{http://www.jstatsoft.org/v40/i01/}.}
-\arguments{
- \item{.data}{matrix, array or data frame to be processed}
- \item{.margins}{a vector giving the subscripts to split up \code{data} by. 1 splits up by rows, 2 by columns and c(1,2) by rows and columns, and so on for higher dimensions}
- \item{.fun}{function to apply to each piece}
- \item{...}{other arguments passed on to \code{.fun}}
- \item{.expand}{if \code{.data} is a data frame, should output be 1d
-(expand = FALSE), with an element for each row; or nd (expand = TRUE),
-with a dimension for each variable.}
- \item{.progress}{name of the progress bar to use, see \code{\link{create_progress_bar}}}
- \item{.parallel}{if \code{TRUE}, apply function in parallel, using parallel
-backend provided by foreach}
+\references{
+ Hadley Wickham (2011). The Split-Apply-Combine Strategy
+ for Data Analysis. Journal of Statistical Software,
+ 40(1), 1-29. \url{http://www.jstatsoft.org/v40/i01/}.
}
+\keyword{manip}
+
View
66 man/alply.Rd
@@ -1,44 +1,62 @@
\name{alply}
\alias{alply}
\title{Split array, apply function, and return results in a list.}
-\usage{alply(.data, .margins, .fun = NULL, ..., .expand = TRUE,
- .progress = "none", .parallel = FALSE)}
+\usage{
+ alply(.data, .margins, .fun = NULL, ..., .expand = TRUE,
+ .progress = "none", .parallel = FALSE)
+}
+\arguments{
+ \item{.data}{matrix, array or data frame to be processed}
+
+ \item{.margins}{a vector giving the subscripts to split
+ up \code{data} by. 1 splits up by rows, 2 by columns and
+ c(1,2) by rows and columns, and so on for higher
+ dimensions}
+
+ \item{.fun}{function to apply to each piece}
+ \item{...}{other arguments passed on to \code{.fun}}
+
+ \item{.expand}{if \code{.data} is a data frame, should
+ output be 1d (expand = FALSE), with an element for each
+ row; or nd (expand = TRUE), with a dimension for each
+ variable.}
+
+ \item{.progress}{name of the progress bar to use, see
+ \code{\link{create_progress_bar}}}
+
+ \item{.parallel}{if \code{TRUE}, apply function in
+ parallel, using parallel backend provided by foreach}
+}
+\value{
+ list of results
+}
\description{
Split array, apply function, and return results in a
list. For each slice of an array, apply function then
combine results into a list
}
-
\details{
All plyr functions use the same split-apply-combine
strategy: they split the input into simpler pieces, apply
\code{.fun} to each piece, and then combine the pieces
into a single data structure. This function splits
matrices, arrays and data frames by dimensions and
- combines the result into a list. If there are no
- results, then this function will return a list of length
- 0 (\code{list()}).
+ combines the result into a list. If there are no results,
+ then this function will return a list of length 0
+ (\code{list()}).
\code{alply} is somewhat similar to \code{\link{apply}}
for cases where the results are not atomic.
}
-\keyword{manip}
-\references{Hadley Wickham (2011). The Split-Apply-Combine Strategy for
-Data Analysis. Journal of Statistical Software, 40(1), 1-29.
-\url{http://www.jstatsoft.org/v40/i01/}.}
-\value{list of results}
-\arguments{
- \item{.data}{matrix, array or data frame to be processed}
- \item{.margins}{a vector giving the subscripts to split up \code{data} by. 1 splits up by rows, 2 by columns and c(1,2) by rows and columns, and so on for higher dimensions}
- \item{.fun}{function to apply to each piece}
- \item{...}{other arguments passed on to \code{.fun}}
- \item{.expand}{if \code{.data} is a data frame, should output be 1d
-(expand = FALSE), with an element for each row; or nd (expand = TRUE),
-with a dimension for each variable.}
- \item{.progress}{name of the progress bar to use, see \code{\link{create_progress_bar}}}
- \item{.parallel}{if \code{TRUE}, apply function in parallel, using parallel
-backend provided by foreach}
+\examples{
+alply(ozone, 3, quantile)
+alply(ozone, 3, function(x) table(round(x)))
+}
+\references{
+ Hadley Wickham (2011). The Split-Apply-Combine Strategy
+ for Data Analysis. Journal of Statistical Software,
+ 40(1), 1-29. \url{http://www.jstatsoft.org/v40/i01/}.
}
-\examples{alply(ozone, 3, quantile)
-alply(ozone, 3, function(x) table(round(x)))}
+\keyword{manip}
+
View
12 man/amv_dim.Rd
@@ -1,13 +1,15 @@
\name{amv_dim}
\alias{amv_dim}
\title{Dimensions.}
-\usage{amv_dim(x)}
-
+\usage{
+ amv_dim(x)
+}
+\arguments{
+ \item{x}{array, matrix or vector}
+}
\description{
Dimensions. Consistent dimensions for vectors, matrices
and arrays.
}
\keyword{internal}
-\arguments{
- \item{x}{array, matrix or vector}
-}
+
View
13 man/amv_dimnames.Rd
@@ -1,20 +1,21 @@
\name{amv_dimnames}
\alias{amv_dimnames}
\title{Dimension names.}
-\usage{amv_dimnames(x)}
-
+\usage{
+ amv_dimnames(x)
+}
+\arguments{
+ \item{x}{array, matrix or vector}
+}
\description{
Dimension names. Consistent dimnames for vectors,
matrices and arrays.
}
-
\details{
Unlike \code{\link{dimnames}} no part of the output will
ever be null. If a component of dimnames is omitted,
\code{amv_dimnames} will return an integer sequence of
the appropriate length.
}
\keyword{internal}
-\arguments{
- \item{x}{array, matrix or vector}
-}
+
View
24 man/arrange.Rd
@@ -1,25 +1,29 @@
\name{arrange}
\alias{arrange}
\title{Order a data frame by its colums.}
-\usage{arrange(df, ...)}
+\usage{
+ arrange(df, ...)
+}
+\arguments{
+ \item{df}{data frame to reorder}
+ \item{...}{expressions evaluated in the context of
+ \code{df} and then fed to \code{\link{order}}}
+}
\description{
Order a data frame by its colums.
}
-
\details{
This function completes the subsetting, transforming and
ordering triad with a function that works in a similar
way to \code{\link{subset}} and \code{\link{transform}}
but for reordering a data frame by its columns. This
saves a lot of typing!
}
-\keyword{manip}
-\arguments{
- \item{df}{data frame to reorder}
- \item{...}{expressions evaluated in the context of \code{df} and then fed
-to \code{\link{order}}}
-}
-\examples{mtcars[with(mtcars, order(cyl, disp)), ]
+\examples{
+mtcars[with(mtcars, order(cyl, disp)), ]
arrange(mtcars, cyl, disp)
-arrange(mtcars, cyl, desc(disp))}
+arrange(mtcars, cyl, desc(disp))
+}
+\keyword{manip}
+
View
24 man/as.data.frame.function.Rd
@@ -1,13 +1,24 @@
\name{as.data.frame.function}
\alias{as.data.frame.function}
\title{Make a function return a data frame.}
-\usage{\method{as.data.frame}{function} (x, row.names, optional,
- ...)}
+\usage{
+ \method{as.data.frame}{function} (x, row.names, optional,
+ ...)
+}
+\arguments{
+ \item{x}{function to make return a data frame}
+
+ \item{row.names}{necessary to match the generic, but not
+ used}
+ \item{optional}{necessary to match the generic, but not
+ used}
+
+ \item{...}{necessary to match the generic, but not used}
+}
\description{
Make a function return a data frame.
}
-
\details{
Create a new function that returns the existing function
wrapped in a data.frame
@@ -17,9 +28,4 @@
in rows, rather than columns
}
\keyword{manip}
-\arguments{
- \item{x}{function to make return a data frame}
- \item{row.names}{necessary to match the generic, but not used}
- \item{optional}{necessary to match the generic, but not used}
- \item{...}{necessary to match the generic, but not used}
-}
+
View
13 man/as.list.split.Rd
@@ -1,14 +1,17 @@
\name{as.list.split}
\alias{as.list.split}
\title{Convert split list to regular list.}
-\usage{\method{as.list}{split} (x, ...)}
+\usage{
+ \method{as.list}{split} (x, ...)
+}
+\arguments{
+ \item{x}{object to convert to a list}
+ \item{...}{unused}
+}
\description{
Convert split list to regular list. Strip off label
related attributed to make a strip list as regular list
}
\keyword{internal}
-\arguments{
- \item{x}{object to convert to a list}
- \item{...}{unused}
-}
+
View
48 man/as.quoted.Rd
@@ -1,12 +1,31 @@
\name{as.quoted}
+\alias{as.quoted}
+\alias{as.quoted.call}
+\alias{as.quoted.character}
+\alias{as.quoted.formula}
+\alias{as.quoted.quoted}
+\alias{as.quoted.NULL}
+\alias{as.quoted.numeric}
+\alias{c.quoted}
+\alias{"[.quoted"}
\title{Convert input to quoted variables.}
-\usage{as.quoted(x, env = parent.frame())}
+\usage{
+ as.quoted(x, env = parent.frame())
+}
+\arguments{
+ \item{x}{input to quote}
+ \item{env}{environment in which unbound symbols in
+ expression should be evaluated. Defaults to the
+ environment in which \code{as.quoted} was executed.}
+}
+\value{
+ a list of quoted variables
+}
\description{
Convert input to quoted variables. Convert characters,
formulas and calls to quoted .variables
}
-
\details{
This method is called by default on all plyr functions
that take a \code{.variables} argument, so that
@@ -15,22 +34,11 @@
Currently conversions exist for character vectors,
formulas and call objects.
}
-\value{a list of quoted variables}
-\seealso{\code{\link{.}}}
-\alias{as.quoted.call}
-\alias{as.quoted.character}
-\alias{as.quoted.formula}
-\alias{as.quoted.quoted}
-\alias{as.quoted.NULL}
-\alias{as.quoted.numeric}
-\alias{c.quoted}
-\alias{as.quoted}
-\alias{[.quoted}
-\arguments{
- \item{x}{input to quote}
- \item{env}{environment in which unbound symbols in expression should be
-evaluated. Defaults to the environment in which \code{as.quoted} was
-executed.}
+\examples{
+as.quoted(c("a", "b", "log(d)"))
+as.quoted(a ~ b + log(d))
+}
+\seealso{
+ \code{\link{.}}
}
-\examples{as.quoted(c("a", "b", "log(d)"))
-as.quoted(a ~ b + log(d))}
+
View
35 man/colwise.Rd
@@ -1,32 +1,35 @@
\name{colwise}
+\alias{colwise}
+\alias{catcolwise}
+\alias{numcolwise}
\title{Column-wise function.}
-\usage{colwise(.fun, .cols = true)}
+\usage{
+ colwise(.fun, .cols = true)
+}
+\arguments{
+ \item{.fun}{function}
+ \item{.cols}{either a function that tests columns for
+ inclusion, or a quoted object giving which columns to
+ process}
+}
\description{
Column-wise function. Turn a function that operates on a
vector into a function that operates column-wise on a
data.frame.
}
-
\details{
\code{catcolwise} and \code{numcolwise} provide version
that only operate on discrete and numeric variables
respectively.
}
-\alias{colwise}
-\alias{catcolwise}
-\alias{numcolwise}
-\arguments{
- \item{.fun}{function}
- \item{.cols}{either a function that tests columns for inclusion, or a
-quoted object giving which columns to process}
-}
-\examples{# Count number of missing values
+\examples{
+# Count number of missing values
nmissing <- function(x) sum(is.na(x))
-# Apply to every column in a data frame
+# Apply to every column in a data frame
colwise(nmissing)(baseball)
-# This syntax looks a little different. It is shorthand for the
+# This syntax looks a little different. It is shorthand for the
# the following:
f <- colwise(nmissing)
f(baseball)
@@ -46,7 +49,9 @@ ddply(baseball, .(year), colwise(nmissing, is.character))
ddply(baseball, .(year), colwise(nmissing, is.numeric))
ddply(baseball, .(year), colwise(nmissing, is.discrete))
-# These last two cases are particularly common, so some shortcuts are
+# These last two cases are particularly common, so some shortcuts are
# provided:
ddply(baseball, .(year), numcolwise(nmissing))
-ddply(baseball, .(year), catcolwise(nmissing))}
+ddply(baseball, .(year), catcolwise(nmissing))
+}
+
View
12 man/compact.Rd
@@ -1,13 +1,15 @@
\name{compact}
\alias{compact}
\title{Compact list.}
-\usage{compact(l)}
-
+\usage{
+ compact(l)
+}
+\arguments{
+ \item{l}{list}
+}
\description{
Compact list. Remove all NULL entries from a list
}
\keyword{manip}
\keyword{internal}
-\arguments{
- \item{l}{list}
-}
+
View
33 man/count.Rd
@@ -1,12 +1,24 @@
\name{count}
\alias{count}
\title{Count the number of occurences.}
-\usage{count(df, vars = NULL, wt_var = NULL)}
+\usage{
+ count(df, vars = NULL, wt_var = NULL)
+}
+\arguments{
+ \item{df}{data frame to be processed}
+
+ \item{vars}{variables to count unique values of}
+ \item{wt_var}{optional variable to weight by - if this is
+ non-NULL, count will sum up the value of this variable
+ for each combination of id variables.}
+}
+\value{
+ a data frame with label and freq columns
+}
\description{
Count the number of occurences.
}
-
\details{
Equivalent to \code{as.data.frame(table(x))}, but does
not include combinations with zero counts.
@@ -21,19 +33,14 @@
the type of the identifier variables, instead of
converting them to characters/factors.
}
-\value{a data frame with label and freq columns}
-\keyword{manip}
-\arguments{
- \item{df}{data frame to be processed}
- \item{vars}{variables to count unique values of}
- \item{wt_var}{optional variable to weight by - if this is non-NULL, count
-will sum up the value of this variable for each combination of id
-variables.}
-}
-\examples{count(baseball, "id")
+\examples{
+count(baseball, "id")
count(baseball, "id", "g")
count(baseball, "id", "ab")
count(baseball, "lg")
count(baseball, "stint")
count(count(baseball, c("id", "year")), "id", "freq")
-count(count(baseball, c("id", "year")), "freq")}
+count(count(baseball, c("id", "year")), "freq")
+}
+\keyword{manip}
+
View
28 man/create_progress_bar.Rd
@@ -1,13 +1,19 @@
\name{create_progress_bar}
\alias{create_progress_bar}
\title{Create progress bar.}
-\usage{create_progress_bar(name = "none", ...)}
+\usage{
+ create_progress_bar(name = "none", ...)
+}
+\arguments{
+ \item{name}{type of progress bar to create}
+ \item{...}{other arguments passed onto progress bar
+ function}
+}
\description{
Create progress bar. Create progress bar object from text
string.
}
-
\details{
Progress bars give feedback on how apply step is
proceeding. This is mainly useful for long running
@@ -31,13 +37,15 @@
progress bar object yourself if you want more control
over its apperance. See the examples.
}
-\seealso{\code{\link{progress_none}}, \code{\link{progress_text}}, \code{\link{progress_tk}}, \code{\link{progress_win}}}
-\keyword{utilities}
-\arguments{
- \item{name}{type of progress bar to create}
- \item{...}{other arguments passed onto progress bar function}
-}
-\examples{l_ply(1:1000, identity, .progress = "none")
+\examples{
+l_ply(1:1000, identity, .progress = "none")
l_ply(1:1000, identity, .progress = "tk")
l_ply(1:1000, identity, .progress = "text")
-l_ply(1:1000, identity, .progress = progress_text(char = "-"))}
+l_ply(1:1000, identity, .progress = progress_text(char = "-"))
+}
+\seealso{
+ \code{\link{progress_none}}, \code{\link{progress_text}},
+ \code{\link{progress_tk}}, \code{\link{progress_win}}
+}
+\keyword{utilities}
+
View
39 man/d_ply.Rd
@@ -1,15 +1,31 @@
\name{d_ply}
\alias{d_ply}
\title{Split data frame, apply function, and discard results.}
-\usage{d_ply(.data, .variables, .fun = NULL, ..., .progress =
- "none", .print = FALSE)}
+\usage{
+ d_ply(.data, .variables, .fun = NULL, ..., .progress =
+ "none", .print = FALSE)
+}
+\arguments{
+ \item{.data}{data frame to be processed}
+
+ \item{.variables}{variables to split data frame by, as
+ quoted variables, a formula or character vector}
+
+ \item{.fun}{function to apply to each piece}
+
+ \item{...}{other arguments passed on to \code{.fun}}
+
+ \item{.progress}{name of the progress bar to use, see
+ \code{\link{create_progress_bar}}}
+ \item{.print}{automatically print each result? (default:
+ \code{FALSE})}
+}
\description{
Split data frame, apply function, and discard results.
For each subset of a data frame, apply function and
discard results
}
-
\details{
All plyr functions use the same split-apply-combine
strategy: they split the input into simpler pieces, apply
@@ -19,15 +35,10 @@
useful for functions that you are calling purely for
their side effects like display plots and saving output.
}
-\keyword{manip}
-\references{Hadley Wickham (2011). The Split-Apply-Combine Strategy for
-Data Analysis. Journal of Statistical Software, 40(1), 1-29.
-\url{http://www.jstatsoft.org/v40/i01/}.}
-\arguments{
- \item{.data}{data frame to be processed}
- \item{.variables}{variables to split data frame by, as quoted variables, a formula or character vector}
- \item{.fun}{function to apply to each piece}
- \item{...}{other arguments passed on to \code{.fun}}
- \item{.progress}{name of the progress bar to use, see \code{\link{create_progress_bar}}}
- \item{.print}{automatically print each result? (default: \code{FALSE})}
+\references{
+ Hadley Wickham (2011). The Split-Apply-Combine Strategy
+ for Data Analysis. Journal of Statistical Software,
+ 40(1), 1-29. \url{http://www.jstatsoft.org/v40/i01/}.
}
+\keyword{manip}
+
View
61 man/daply.Rd
@@ -1,15 +1,40 @@
\name{daply}
\alias{daply}
\title{Split data frame, apply function, and return results in an array.}
-\usage{daply(.data, .variables, .fun = NULL, ..., .progress =
- "none", .drop = TRUE, .parallel = FALSE)}
+\usage{
+ daply(.data, .variables, .fun = NULL, ..., .progress =
+ "none", .drop = TRUE, .parallel = FALSE)
+}
+\arguments{
+ \item{.data}{data frame to be processed}
+
+ \item{.variables}{variables to split data frame by, as
+ quoted variables, a formula or character vector}
+
+ \item{.fun}{function to apply to each piece}
+ \item{...}{other arguments passed on to \code{.fun}}
+
+ \item{.progress}{name of the progress bar to use, see
+ \code{\link{create_progress_bar}}}
+
+ \item{.drop}{should extra dimensions of length 1 be
+ dropped, simplifying the output. Defaults to
+ \code{TRUE}}
+
+ \item{.parallel}{if \code{TRUE}, apply function in
+ parallel, using parallel backend provided by foreach}
+}
+\value{
+ if results are atomic with same type and dimensionality,
+ a vector, matrix or array; otherwise, a list-array (a
+ list with dimensions)
+}
\description{
Split data frame, apply function, and return results in
an array. For each subset of data frame, apply function
then combine results into an array
}
-
\details{
All plyr functions use the same split-apply-combine
strategy: they split the input into simpler pieces, apply
@@ -22,26 +47,20 @@
\code{daply} with a function that operates column-wise is
similar to \code{\link{aggregate}}.
}
-\keyword{manip}
-\value{if results are atomic with same type and dimensionality, a vector, matrix or array; otherwise, a list-array (a list with dimensions)}
-\references{Hadley Wickham (2011). The Split-Apply-Combine Strategy for
-Data Analysis. Journal of Statistical Software, 40(1), 1-29.
-\url{http://www.jstatsoft.org/v40/i01/}.}
-\arguments{
- \item{.data}{data frame to be processed}
- \item{.variables}{variables to split data frame by, as quoted variables, a formula or character vector}
- \item{.fun}{function to apply to each piece}
- \item{...}{other arguments passed on to \code{.fun}}
- \item{.progress}{name of the progress bar to use, see \code{\link{create_progress_bar}}}
- \item{.drop}{should extra dimensions of length 1 be dropped, simplifying the output. Defaults to \code{TRUE}}
- \item{.parallel}{if \code{TRUE}, apply function in parallel, using parallel
-backend provided by foreach}
-}
-\examples{daply(baseball, .(year), nrow)
+\examples{
+daply(baseball, .(year), nrow)
-# Several different ways of summarising by variables that should not be
+# Several different ways of summarising by variables that should not be
# included in the summary
daply(baseball[, c(2, 6:9)], .(year), mean)
daply(baseball[, 6:9], .(baseball$year), mean)
-daply(baseball, .(year), function(df) mean(df[, 6:9]))}
+daply(baseball, .(year), function(df) mean(df[, 6:9]))
+}
+\references{
+ Hadley Wickham (2011). The Split-Apply-Combine Strategy
+ for Data Analysis. Journal of Statistical Software,
+ 40(1), 1-29. \url{http://www.jstatsoft.org/v40/i01/}.
+}
+\keyword{manip}
+
View
64 man/ddply.Rd
@@ -1,15 +1,38 @@
\name{ddply}
\alias{ddply}
\title{Split data frame, apply function, and return results in a data frame.}
-\usage{ddply(.data, .variables, .fun = NULL, ..., .progress =
- "none", .drop = TRUE, .parallel = FALSE)}
+\usage{
+ ddply(.data, .variables, .fun = NULL, ..., .progress =
+ "none", .drop = TRUE, .parallel = FALSE)
+}
+\arguments{
+ \item{.data}{data frame to be processed}
+
+ \item{.variables}{variables to split data frame by, as
+ quoted variables, a formula or character vector}
+
+ \item{.fun}{function to apply to each piece}
+ \item{.drop}{should combinations of variables that do not
+ appear in the data be preserved (FALSE) or dropped (TRUE,
+ default)}
+
+ \item{...}{other arguments passed on to \code{.fun}}
+
+ \item{.progress}{name of the progress bar to use, see
+ \code{\link{create_progress_bar}}}
+
+ \item{.parallel}{if \code{TRUE}, apply function in
+ parallel, using parallel backend provided by foreach}
+}
+\value{
+ a data frame
+}
\description{
Split data frame, apply function, and return results in a
data frame. For each subset of a data frame, apply
function then combine results into a data frame
}
-
\details{
All plyr functions use the same split-apply-combine
strategy: they split the input into simpler pieces, apply
@@ -27,29 +50,22 @@
will be \code{rbind}ed together and converted to a data
frame. Any other values will result in an error.
}
-\keyword{manip}
-\value{a data frame}
-\references{Hadley Wickham (2011). The Split-Apply-Combine Strategy for
-Data Analysis. Journal of Statistical Software, 40(1), 1-29.
-\url{http://www.jstatsoft.org/v40/i01/}.}
-\arguments{
- \item{.data}{data frame to be processed}
- \item{.variables}{variables to split data frame by, as quoted variables, a formula or character vector}
- \item{.fun}{function to apply to each piece}
- \item{.drop}{should combinations of variables that do not appear in the
-data be preserved (FALSE) or dropped (TRUE, default)}
- \item{...}{other arguments passed on to \code{.fun}}
- \item{.progress}{name of the progress bar to use, see \code{\link{create_progress_bar}}}
- \item{.parallel}{if \code{TRUE}, apply function in parallel, using parallel
-backend provided by foreach}
-}
-\examples{ddply(baseball, .(year), "nrow")
-ddply(baseball, .(lg), c("nrow", "ncol"))
+\examples{
+ddply(baseball, .(year), "nrow")
+ddply(baseball, .(lg), c("nrow", "ncol"))
-rbi <- ddply(baseball, .(year), summarise,
+rbi <- ddply(baseball, .(year), summarise,
mean_rbi = mean(rbi, na.rm = TRUE))
with(rbi, plot(year, mean_rbi, type="l"))
-base2 <- ddply(baseball, .(id), transform,
+base2 <- ddply(baseball, .(id), transform,
career_year = year - min(year) + 1
-)}
+)
+}
+\references{
+ Hadley Wickham (2011). The Split-Apply-Combine Strategy
+ for Data Analysis. Journal of Statistical Software,
+ 40(1), 1-29. \url{http://www.jstatsoft.org/v40/i01/}.
+}
+\keyword{manip}
+
View
13 man/defaults.Rd
@@ -1,14 +1,17 @@
\name{defaults}
\alias{defaults}
\title{Set defaults.}
-\usage{defaults(x, y)}
+\usage{
+ defaults(x, y)
+}
+\arguments{
+ \item{x}{list of values}
+ \item{y}{defaults}
+}
\description{
Set defaults. Convient method for combining a list of
values with their defaults.
}
\keyword{manip}
-\arguments{
- \item{x}{list of values}
- \item{y}{defaults}
-}
+
View
21 man/desc.Rd
@@ -1,21 +1,24 @@
\name{desc}
\alias{desc}
\title{Descending order.}
-\usage{desc(x)}
-
+\usage{
+ desc(x)
+}
+\arguments{
+ \item{x}{vector to transform}
+}
\description{
Descending order.
}
-
\details{
Transform a vector into a format that will be sorted in
descending order.
}
-\keyword{manip}
-\arguments{
- \item{x}{vector to transform}
-}
-\examples{desc(1:10)
+\examples{
+desc(1:10)
desc(factor(letters))
first_day <- seq(as.Date("1910/1/1"), as.Date("1920/1/1"), "years")
-desc(first_day)}
+desc(first_day)
+}
+\keyword{manip}
+
View
12 man/dims.Rd
@@ -1,13 +1,15 @@
\name{dims}
\alias{dims}
\title{Number of dimensions.}
-\usage{dims(x)}
-
+\usage{
+ dims(x)
+}
+\arguments{
+ \item{x}{array}
+}
\description{
Number of dimensions. Number of dimensions of an array or
vector
}
\keyword{internal}
-\arguments{
- \item{x}{array}
-}
+
View
60 man/dlply.Rd
@@ -1,15 +1,40 @@
\name{dlply}
\alias{dlply}
\title{Split data frame, apply function, and return results in a list.}
-\usage{dlply(.data, .variables, .fun = NULL, ..., .progress =
- "none", .drop = TRUE, .parallel = FALSE)}
+\usage{
+ dlply(.data, .variables, .fun = NULL, ..., .progress =
+ "none", .drop = TRUE, .parallel = FALSE)
+}
+\arguments{
+ \item{.data}{data frame to be processed}
+
+ \item{.variables}{variables to split data frame by, as
+ quoted variables, a formula or character vector}
+
+ \item{.fun}{function to apply to each piece}
+ \item{...}{other arguments passed on to \code{.fun}}
+
+ \item{.progress}{name of the progress bar to use, see
+ \code{\link{create_progress_bar}}}
+
+ \item{.drop}{should combinations of variables that do not
+ appear in the data be preserved (FALSE) or dropped (TRUE,
+ default)}
+
+ \item{.parallel}{if \code{TRUE}, apply function in
+ parallel, using parallel backend provided by foreach}
+}
+\value{
+ if results are atomic with same type and dimensionality,
+ a vector, matrix or array; otherwise, a list-array (a
+ list with dimensions)
+}
\description{
Split data frame, apply function, and return results in a
list. For each subset of a data frame, apply function
then combine results into a list
}
-
\details{
All plyr functions use the same split-apply-combine
strategy: they split the input into simpler pieces, apply
@@ -22,27 +47,20 @@
\code{dlply} is similar to \code{\link{by}} except that
the results are returned in a different format.
}
-\keyword{manip}
-\value{if results are atomic with same type and dimensionality, a vector, matrix or array; otherwise, a list-array (a list with dimensions)}
-\references{Hadley Wickham (2011). The Split-Apply-Combine Strategy for
-Data Analysis. Journal of Statistical Software, 40(1), 1-29.
-\url{http://www.jstatsoft.org/v40/i01/}.}
-\arguments{
- \item{.data}{data frame to be processed}
- \item{.variables}{variables to split data frame by, as quoted variables, a formula or character vector}
- \item{.fun}{function to apply to each piece}
- \item{...}{other arguments passed on to \code{.fun}}
- \item{.progress}{name of the progress bar to use, see \code{\link{create_progress_bar}}}
- \item{.drop}{should combinations of variables that do not appear in the
-data be preserved (FALSE) or dropped (TRUE, default)}
- \item{.parallel}{if \code{TRUE}, apply function in parallel, using parallel
-backend provided by foreach}
-}
-\examples{linmod <- function(df) lm(rbi ~ year, data = mutate(df, year = year - min(year)))
+\examples{
+linmod <- function(df) lm(rbi ~ year, data = mutate(df, year = year - min(year)))
models <- dlply(baseball, .(id), linmod)
models[[1]]
coef <- ldply(models, coef)
with(coef, plot(`(Intercept)`, year))
qual <- laply(models, function(mod) summary(mod)$r.squared)
-hist(qual)}
+hist(qual)
+}
+\references{
+ Hadley Wickham (2011). The Split-Apply-Combine Strategy
+ for Data Analysis. Journal of Statistical Software,
+ 40(1), 1-29. \url{http://www.jstatsoft.org/v40/i01/}.
+}
+\keyword{manip}
+
View
21 man/each.Rd
@@ -1,24 +1,27 @@
\name{each}
\alias{each}
\title{Aggregate multiple functions into a single function.}
-\usage{each(...)}
-
+\usage{
+ each(...)
+}
+\arguments{
+ \item{...}{functions to combine}
+}
\description{
Aggregate multiple functions into a single function.
}
-
\details{
Combine multiple functions to a single function returning
a named vector of outputs
Each function should produce a single number as output
}
-\keyword{manip}
-\arguments{
- \item{...}{functions to combine}
-}
-\examples{each(min, max)(1:10)
+\examples{
+each(min, max)(1:10)
each("min", "max")(1:10)
each(c("min", "max"))(1:10)
each(c(min, max))(1:10)
-each(length, mean, var)(rnorm(100))}
+each(length, mean, var)(rnorm(100))
+}
+\keyword{manip}
+
View
12 man/empty.Rd
@@ -1,13 +1,15 @@
\name{empty}
\alias{empty}
\title{Check if a data frame is empty.}
-\usage{empty(df)}
-
+\usage{
+ empty(df)
+}
+\arguments{
+ \item{df}{data frame to check}
+}
\description{
Check if a data frame is empty. Empty if it's null or it
has 0 rows or columns
}
\keyword{internal}
-\arguments{
- \item{df}{data frame to check}
-}
+
View
20 man/eval.quoted.Rd
@@ -1,16 +1,22 @@
\name{eval.quoted}
\alias{eval.quoted}
\title{Evaluate a quoted list of variables.}
-\usage{eval.quoted(exprs, envir = NULL, enclos = NULL, try =
- FALSE)}
+\usage{
+ eval.quoted(exprs, envir = NULL, enclos = NULL, try =
+ FALSE)
+}
+\arguments{
+ \item{expr}{quoted object to evalution}
+ \item{try}{if TRUE, return \code{NULL} if evaluation
+ unsuccesful}
+}
+\value{
+ a list
+}
\description{
Evaluate a quoted list of variables. Evaluates quoted
variables in specified environment
}
-\value{a list}
\keyword{internal}
-\arguments{
- \item{expr}{quoted object to evalution}
- \item{try}{if TRUE, return \code{NULL} if evaluation unsuccesful}
-}
+
View
33 man/failwith.Rd
@@ -1,30 +1,39 @@
\name{failwith}
\alias{failwith}
\title{Fail with specified value.}
-\usage{failwith(default = NULL, f, quiet = FALSE)}
+\usage{
+ failwith(default = NULL, f, quiet = FALSE)
+}
+\arguments{
+ \item{default}{default value}
+
+ \item{f}{function}
+ \item{quiet}{all error messages be suppressed?}
+}
+\value{
+ a function
+}
\description{
Fail with specified value.
}
-
\details{
Modify a function so that it returns a default value when
there is an error.
}
-\value{a function}
-\seealso{\code{\link{try_default}}}
-\keyword{debugging}
-\arguments{
- \item{default}{default value}
- \item{f}{function}
- \item{quiet}{all error messages be suppressed?}
-}
-\examples{f <- function(x) if (x == 1) stop("Error!") else 1
+\examples{
+f <- function(x) if (x == 1) stop("Error!") else 1
\dontrun{
f(1)
f(2)
}
safef <- failwith(NULL, f)
safef(1)
-safef(2)}
+safef(2)
+}
+\seealso{
+ \code{\link{try_default}}
+}
+\keyword{debugging}
+
View
16 man/get-split.Rd
@@ -1,15 +1,17 @@
\name{get-split}
+\alias{get-split}
+\alias{"[.split"}
\title{Subset splits.}
-\usage{\method{[}{split} (x, i, ...)}
+\arguments{
+ \item{x}{split object}
+
+ \item{i}{index}
+ \item{...}{unused}
+}
\description{
Subset splits. Subset splits, ensuring that labels keep
matching
}
\keyword{internal}
-\alias{[.split}
-\arguments{
- \item{x}{split object}
- \item{i}{index}
- \item{...}{unused}
-}
+
View
28 man/id.Rd
@@ -1,25 +1,31 @@
\name{id}
+\alias{id}
+\alias{ninteraction}
\title{Compute a unique numeric id for each unique row in a data frame.}
-\usage{id(.variables, drop = FALSE)}
+\usage{
+ id(.variables, drop = FALSE)
+}
+\arguments{
+ \item{.variables}{list of variables}
+ \item{drop}{drop unusued factor levels?}
+}
+\value{
+ a numeric vector with attribute n, giving total number of
+ possibilities
+}
\description{
Compute a unique numeric id for each unique row in a data
frame.
}
-
\details{
Properties: \itemize{ \item \code{order(id)} is
equivalent to \code{do.call(order, df)} \item rows
containing the same data have the same value \item if
\code{drop = FALSE} then room for all possibilites }
}
-\value{a numeric vector with attribute n, giving total number of
-possibilities}
-\keyword{internal}
-\seealso{\code{\link{id_var}}}
-\alias{id}
-\alias{ninteraction}
-\arguments{
- \item{.variables}{list of variables}
- \item{drop}{drop unusued factor levels?}
+\seealso{
+ \code{\link{id_var}}
}
+\keyword{internal}
+
View
6 man/id_var.Rd
@@ -1,9 +1,11 @@
\name{id_var}
\alias{id_var}
\title{Numeric id for a vector.}
-\usage{id_var(x, drop = FALSE)}
-
+\usage{
+ id_var(x, drop = FALSE)
+}
\description{
Numeric id for a vector.
}
\keyword{internal}
+
View
23 man/idata.frame.Rd
@@ -1,12 +1,18 @@
\name{idata.frame}
\alias{idata.frame}
\title{Construct an immutable data frame.}
-\usage{idata.frame(df)}
-
+\usage{
+ idata.frame(df)
+}
+\arguments{
+ \item{df}{a data frame}
+}
+\value{
+ an immutable data frame
+}
\description{
Construct an immutable data frame.
}
-
\details{
An immutable data frame works like an ordinary data
frame, except that when you subset it, it returns a
@@ -18,10 +24,9 @@
This method is still a little experimental, so please let
me know if you run into any problems.
}
-\value{an immutable data frame}
-\keyword{manip}
-\arguments{
- \item{df}{a data frame}
+\examples{
+system.time(dlply(baseball, "id", nrow))
+system.time(dlply(idata.frame(baseball), "id", nrow))
}
-\examples{system.time(dlply(baseball, "id", nrow))
-system.time(dlply(idata.frame(baseball), "id", nrow))}
+\keyword{manip}
+
View
21 man/indexed_array.Rd
@@ -1,17 +1,20 @@
\name{indexed_array}
-\title{An indexed array.}
-\usage{indexed_array(env, index)}
-
-\description{
- An indexed array. Create a indexed array, a space
- efficient way of indexing into a large array.
-}
-\keyword{internal}
\alias{indexed_array}
-\alias{[[.indexed_array}
+\alias{"[[.indexed_array"}
\alias{names.indexed_array}
\alias{length.indexed_array}
+\title{An indexed array.}
+\usage{
+ indexed_array(env, index)
+}
\arguments{
\item{env}{environment containing data frame}
+
\item{index}{list of indices}
}
+\description{
+ An indexed array. Create a indexed array, a space
+ efficient way of indexing into a large array.
+}
+\keyword{internal}
+
View
27 man/indexed_df.Rd
@@ -1,21 +1,26 @@
\name{indexed_df}
-\title{An indexed data frame.}
-\usage{indexed_df(data, index, vars)}
-
-\description{
- An indexed data frame. Create a indexed list, a space
- efficient way of indexing into a large data frame
-}
-\keyword{internal}
\alias{indexed_df}
\alias{length.indexed}
\alias{names.indexed}
\alias{as.list.indexed}
-\alias{[[.indexed_df}
-\alias{[.indexed}
+\alias{"[[.indexed_df"}
+\alias{"[.indexed"}
\alias{print.indexed}
+\title{An indexed data frame.}
+\usage{
+ indexed_df(data, index, vars)
+}
\arguments{
\item{env}{environment containing data frame}
+
\item{index}{list of indices}
- \item{vars}{a character vector giving the variables used for subsetting}
+
+ \item{vars}{a character vector giving the variables used
+ for subsetting}
+}
+\description{
+ An indexed data frame. Create a indexed list, a space
+ efficient way of indexing into a large data frame
}
+\keyword{internal}
+
View
20 man/is.discrete.Rd
@@ -1,16 +1,20 @@
\name{is.discrete}
\alias{is.discrete}
\title{Determine if a vector is discrete.}
-\usage{is.discrete(x)}
-
-\description{
- Determine if a vector is discrete. A discrete vector is a
- factor or a character vector
+\usage{
+ is.discrete(x)
}
-\keyword{internal}
\arguments{
\item{x}{vector to test}
}
-\examples{is.discrete(1:10)
+\description{
+ Determine if a vector is discrete. A discrete vector is a
+ factor or a character vector
+}
+\examples{
+is.discrete(1:10)
is.discrete(c("a", "b", "c"))
-is.discrete(factor(c("a", "b", "c")))}
+is.discrete(factor(c("a", "b", "c")))
+}
+\keyword{internal}
+
View
6 man/is.formula.Rd
@@ -1,9 +1,11 @@
\name{is.formula}
\alias{is.formula}
\title{Is a formula?}
-\usage{is.formula(x)}
-
+\usage{
+ is.formula(x)
+}
\description{
Is a formula? Checks if argument is a formula
}
\keyword{internal}
+
View
6 man/isplit2.Rd
@@ -1,9 +1,11 @@
\name{isplit2}
\alias{isplit2}
\title{Split iterator that returns values, not indices.}
-\usage{isplit2(x, f, drop = FALSE, ...)}
-
+\usage{
+ isplit2(x, f, drop = FALSE, ...)
+}
\description{
Split iterator that returns values, not indices.
}
\keyword{internal}
+
View
38 man/join.Rd
@@ -1,13 +1,27 @@
\name{join}
\alias{join}
\title{Join two data frames together.}
-\usage{join(x, y, by = intersect(names(x), names(y)), type =
- "left", match = "all")}
+\usage{
+ join(x, y, by = intersect(names(x), names(y)), type =
+ "left", match = "all")
+}
+\arguments{
+ \item{x}{data frame}
+
+ \item{y}{data frame}
+ \item{by}{character vector of variable names to join by}
+
+ \item{type}{type of join: left (default), right, inner or
+ full. See details for more information.}
+
+ \item{match}{how should duplicate ids be matched? Either
+ match just the \code{"first"} matching row, or match
+ \code{"all"} matching rows.}
+}
\description{
Join two data frames together.
}
-
\details{
Join, like merge, is designed for the types of problems
where you would use a sql join. The four join types
@@ -31,20 +45,14 @@
way to rename output or merge on different variables in
the x and y data frames.
}
-\keyword{manip}
-\arguments{
- \item{x}{data frame}
- \item{y}{data frame}
- \item{by}{character vector of variable names to join by}
- \item{type}{type of join: left (default), right, inner or full. See
-details for more information.}
- \item{match}{how should duplicate ids be matched? Either match just the
-\code{"first"} matching row, or match \code{"all"} matching rows.}
-}
-\examples{first <- ddply(baseball, "id", summarise, first = min(year))
+\examples{
+first <- ddply(baseball, "id", summarise, first = min(year))
system.time(b2 <- merge(baseball, first, by = "id", all.x = TRUE))
system.time(b3 <- join(baseball, first, by = "id"))
b2 <- arrange(b2, id, year, stint)
b3 <- arrange(b3, id, year, stint)
-stopifnot(all.equal(b2, b3))}
+stopifnot(all.equal(b2, b3))
+}
+\keyword{manip}
+
View
16 man/join.keys.Rd
@@ -1,15 +1,19 @@
\name{join.keys}
\alias{join.keys}
\title{Join keys.}
-\usage{join.keys(x, y, by)}
-
-\description{
- Join keys. Given two data frames, create a unique key for
- each row.
+\usage{
+ join.keys(x, y, by)
}
-\keyword{internal}
\arguments{
\item{x}{data frame}
+
\item{y}{data frame}
+
\item{by}{character vector of variable names to join by}
}
+\description{
+ Join keys. Given two data frames, create a unique key for
+ each row.
+}
+\keyword{internal}
+
View
35 man/l_ply.Rd
@@ -1,14 +1,27 @@
\name{l_ply}
\alias{l_ply}
\title{Split list, apply function, and discard results.}
-\usage{l_ply(.data, .fun = NULL, ..., .progress = "none", .print =
- FALSE)}
+\usage{
+ l_ply(.data, .fun = NULL, ..., .progress = "none", .print
+ = FALSE)
+}
+\arguments{
+ \item{.data}{list to be processed}
+
+ \item{.fun}{function to apply to each piece}
+ \item{...}{other arguments passed on to \code{.fun}}
+
+ \item{.progress}{name of the progress bar to use, see
+ \code{\link{create_progress_bar}}}
+
+ \item{.print}{automatically print each result? (default:
+ \code{FALSE})}
+}
\description{
Split list, apply function, and discard results. For each
element of a list, apply function and discard results
}
-
\details{
All plyr functions use the same split-apply-combine
strategy: they split the input into simpler pieces, apply
@@ -18,14 +31,10 @@
functions that you are calling purely for their side
effects like display plots and saving output.
}
-\keyword{manip}
-\references{Hadley Wickham (2011). The Split-Apply-Combine Strategy for
-Data Analysis. Journal of Statistical Software, 40(1), 1-29.
-\url{http://www.jstatsoft.org/v40/i01/}.}
-\arguments{
- \item{.data}{list to be processed}
- \item{.fun}{function to apply to each piece}
- \item{...}{other arguments passed on to \code{.fun}}
- \item{.progress}{name of the progress bar to use, see \code{\link{create_progress_bar}}}
- \item{.print}{automatically print each result? (default: \code{FALSE})}
+\references{
+ Hadley Wickham (2011). The Split-Apply-Combine Strategy
+ for Data Analysis. Journal of Statistical Software,
+ 40(1), 1-29. \url{http://www.jstatsoft.org/v40/i01/}.
}
+\keyword{manip}
+
View
55 man/laply.Rd
@@ -1,15 +1,37 @@
\name{laply}
\alias{laply}
\title{Split list, apply function, and return results in an array.}
-\usage{laply(.data, .fun = NULL, ..., .progress = "none", .drop =
- TRUE, .parallel = FALSE)}
+\usage{
+ laply(.data, .fun = NULL, ..., .progress = "none", .drop
+ = TRUE, .parallel = FALSE)
+}
+\arguments{
+ \item{.data}{input list}
+ \item{.fun}{function to apply to each piece}
+
+ \item{...}{other arguments passed on to \code{.fun}}
+
+ \item{.progress}{name of the progress bar to use, see
+ \code{\link{create_progress_bar}}}
+
+ \item{.drop}{should extra dimensions of length 1 be
+ dropped, simplifying the output. Defaults to
+ \code{TRUE}}
+
+ \item{.parallel}{if \code{TRUE}, apply function in
+ parallel, using parallel backend provided by foreach}
+}
+\value{
+ if results are atomic with same type and dimensionality,
+ a vector, matrix or array; otherwise, a list-array (a
+ list with dimensions)
+}
\description{
Split list, apply function, and return results in an
array. For each element of a list, apply function then
combine results into an array
}
-
\details{
All plyr functions use the same split-apply-combine
strategy: they split the input into simpler pieces, apply
@@ -25,25 +47,20 @@
\code{sapply} - each element of the list corresponds to a
column, not a row.
}
-\keyword{manip}
-\value{if results are atomic with same type and dimensionality, a vector, matrix or array; otherwise, a list-array (a list with dimensions)}
-\references{Hadley Wickham (2011). The Split-Apply-Combine Strategy for
-Data Analysis. Journal of Statistical Software, 40(1), 1-29.
-\url{http://www.jstatsoft.org/v40/i01/}.}
-\arguments{
- \item{.data}{input list}
- \item{.fun}{function to apply to each piece}
- \item{...}{other arguments passed on to \code{.fun}}
- \item{.progress}{name of the progress bar to use, see \code{\link{create_progress_bar}}}
- \item{.drop}{should extra dimensions of length 1 be dropped, simplifying the output. Defaults to \code{TRUE}}
- \item{.parallel}{if \code{TRUE}, apply function in parallel, using parallel
-backend provided by foreach}
-}
-\examples{laply(baseball, is.factor)
+\examples{
+laply(baseball, is.factor)
# cf
ldply(baseball, is.factor)
colwise(is.factor)(baseball)
laply(seq_len(10), identity)
laply(seq_len(10), rep, times = 4)
-laply(seq_len(10), matrix, nrow = 2, ncol = 2)}
+laply(seq_len(10), matrix, nrow = 2, ncol = 2)
+}
+\references{
+ Hadley Wickham (2011). The Split-Apply-Combine Strategy
+ for Data Analysis. Journal of Statistical Software,
+ 40(1), 1-29. \url{http://www.jstatsoft.org/v40/i01/}.
+}
+\keyword{manip}
+
View
40 man/ldply.Rd
@@ -1,15 +1,31 @@
\name{ldply}
\alias{ldply}
\title{Split list, apply function, and return results in a data frame.}
-\usage{ldply(.data, .fun = NULL, ..., .progress = "none",
- .parallel = FALSE)}
+\usage{
+ ldply(.data, .fun = NULL, ..., .progress = "none",
+ .parallel = FALSE)
+}
+\arguments{
+ \item{.data}{list to be processed}
+
+ \item{.fun}{function to apply to each piece}
+ \item{...}{other arguments passed on to \code{.fun}}
+
+ \item{.progress}{name of the progress bar to use, see
+ \code{\link{create_progress_bar}}}
+
+ \item{.parallel}{if \code{TRUE}, apply function in
+ parallel, using parallel backend provided by foreach}
+}
+\value{
+ a data frame
+}
\description{
Split list, apply function, and return results in a data
frame. For each element of a list, apply function then
combine results into a data frame
}
-
\details{
All plyr functions use the same split-apply-combine
strategy: they split the input into simpler pieces, apply