Skip to content
Browse files

Consistently align multiline f args

  • Loading branch information...
1 parent 6ea041a commit 5fcf0bb51674804a8a07cd3f13ba611838cad72c @hadley committed Oct 11, 2012
Showing with 21 additions and 11 deletions.
  1. +2 −1 R/aaply.r
  2. +2 −1 R/adply.r
  3. +2 −1 R/alply.r
  4. +2 −1 R/daply.r
  5. +2 −1 R/ddply.r
  6. +2 −1 R/dlply.r
  7. +2 −1 R/laply.r
  8. +2 −1 R/ldply.r
  9. +1 −1 R/maply.r
  10. +2 −1 R/mdply.r
  11. +2 −1 R/mlply.r
View
3 R/aaply.r
@@ -30,7 +30,8 @@
#' aaply(ozone, 1:2, standardise)
#'
#' aaply(ozone, 1:2, diff)
-aaply <- function(.data, .margins, .fun = NULL, ..., .expand = TRUE, .progress = "none", .drop = TRUE, .parallel = FALSE) {
+aaply <- function(.data, .margins, .fun = NULL, ..., .expand = TRUE,
+ .progress = "none", .drop = TRUE, .parallel = FALSE) {
pieces <- splitter_a(.data, .margins, .expand)
laply(.data = pieces, .fun = .fun, ...,
View
3 R/adply.r
@@ -7,7 +7,8 @@
#' @template a-
#' @template -d
#' @export
-adply <- function(.data, .margins, .fun = NULL, ..., .expand = TRUE, .progress = "none", .parallel = FALSE) {
+adply <- function(.data, .margins, .fun = NULL, ..., .expand = TRUE,
+ .progress = "none", .parallel = FALSE) {
pieces <- splitter_a(.data, .margins, .expand)
ldply(.data = pieces, .fun = .fun, ...,
View
3 R/alply.r
@@ -13,7 +13,8 @@
#' @examples
#' alply(ozone, 3, quantile)
#' alply(ozone, 3, function(x) table(round(x)))
-alply <- function(.data, .margins, .fun = NULL, ..., .expand = TRUE, .progress = "none", .parallel = FALSE) {
+alply <- function(.data, .margins, .fun = NULL, ..., .expand = TRUE,
+ .progress = "none", .parallel = FALSE) {
pieces <- splitter_a(.data, .margins, .expand)
llply(.data = pieces, .fun = .fun, ...,
View
3 R/daply.r
@@ -31,7 +31,8 @@
#' daply(baseball[, c(2, 6:9)], .(year), colwise(mean))
#' daply(baseball[, 6:9], .(baseball$year), colwise(mean))
#' daply(baseball, .(year), function(df) colwise(mean)(df[, 6:9]))
-daply <- function(.data, .variables, .fun = NULL, ..., .progress = "none", .drop_i = TRUE, .drop_o = TRUE, .parallel = FALSE) {
+daply <- function(.data, .variables, .fun = NULL, ..., .progress = "none",
+ .drop_i = TRUE, .drop_o = TRUE, .parallel = FALSE) {
.variables <- as.quoted(.variables)
pieces <- splitter_d(.data, .variables, drop = .drop_i)
View
3 R/ddply.r
@@ -46,7 +46,8 @@
#' base2 <- ddply(baseball, .(id), transform,
#' career_year = year - min(year) + 1
#' )
-ddply <- function(.data, .variables, .fun = NULL, ..., .progress = "none", .drop = TRUE, .parallel = FALSE) {
+ddply <- function(.data, .variables, .fun = NULL, ..., .progress = "none",
+ .drop = TRUE, .parallel = FALSE) {
if (empty(.data)) return(.data)
.variables <- as.quoted(.variables)
pieces <- splitter_d(.data, .variables, drop = .drop)
View
3 R/dlply.r
@@ -19,7 +19,8 @@
#' with(coef, plot(`(Intercept)`, year))
#' qual <- laply(models, function(mod) summary(mod)$r.squared)
#' hist(qual)
-dlply <- function(.data, .variables, .fun = NULL, ..., .progress = "none", .drop = TRUE, .parallel = FALSE) {
+dlply <- function(.data, .variables, .fun = NULL, ..., .progress = "none",
+ .drop = TRUE, .parallel = FALSE) {
.variables <- as.quoted(.variables)
pieces <- splitter_d(.data, .variables, drop = .drop)
View
3 R/laply.r
@@ -21,7 +21,8 @@
#' laply(seq_len(10), identity)
#' laply(seq_len(10), rep, times = 4)
#' laply(seq_len(10), matrix, nrow = 2, ncol = 2)
-laply <- function(.data, .fun = NULL, ..., .progress = "none", .drop = TRUE, .parallel = FALSE) {
+laply <- function(.data, .fun = NULL, ..., .progress = "none", .drop = TRUE,
+ .parallel = FALSE) {
if (is.character(.fun)) .fun <- do.call("each", as.list(.fun))
if (!is.function(.fun)) stop(".fun is not a function.")
View
3 R/ldply.r
@@ -7,7 +7,8 @@
#' @template l-
#' @template -d
#' @export
-ldply <- function(.data, .fun = NULL, ..., .progress = "none", .parallel = FALSE) {
+ldply <- function(.data, .fun = NULL, ..., .progress = "none",
+ .parallel = FALSE) {
if (!inherits(.data, "split")) .data <- as.list(.data)
res <- llply(.data = .data, .fun = .fun, ...,
.progress = .progress, .parallel = .parallel)
View
2 R/maply.r
@@ -12,7 +12,7 @@
#' maply(expand.grid(mean = 1:5, sd = 1:5), rnorm, n = 5)
#' maply(cbind(1:5, 1:5), rnorm, n = 5)
maply <- function(.data, .fun = NULL, ..., .expand = TRUE, .progress = "none",
- .drop = TRUE, .parallel = FALSE) {
+ .drop = TRUE, .parallel = FALSE) {
if (is.matrix(.data) & !is.list(.data)) .data <- .matrix_to_df(.data)
f <- splat(.fun)
View
3 R/mdply.r
@@ -12,7 +12,8 @@
#' mdply(expand.grid(mean = 1:5, sd = 1:5), rnorm, n = 2)
#' mdply(cbind(mean = 1:5, sd = 1:5), rnorm, n = 5)
#' mdply(cbind(mean = 1:5, sd = 1:5), as.data.frame(rnorm), n = 5)
-mdply <- function(.data, .fun = NULL, ..., .expand = TRUE, .progress = "none", .parallel = FALSE) {
+mdply <- function(.data, .fun = NULL, ..., .expand = TRUE, .progress = "none",
+ .parallel = FALSE) {
if (is.matrix(.data) & !is.list(.data)) .data <- .matrix_to_df(.data)
f <- splat(.fun)
View
3 R/mlply.r
@@ -14,7 +14,8 @@
#' mlply(cbind(1:4, 4:1), seq)
#' mlply(cbind(1:4, length = 4:1), seq)
#' mlply(cbind(1:4, by = 4:1), seq, to = 20)
-mlply <- function(.data, .fun = NULL, ..., .expand = TRUE, .progress = "none", .parallel = FALSE) {
+mlply <- function(.data, .fun = NULL, ..., .expand = TRUE, .progress = "none",
+ .parallel = FALSE) {
if (is.matrix(.data) & !is.list(.data)) .data <- .matrix_to_df(.data)
f <- splat(.fun)

0 comments on commit 5fcf0bb

Please sign in to comment.
Something went wrong with that request. Please try again.