Skip to content

Commit

Permalink
version 0.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley authored and cran-robot committed May 14, 2019
1 parent 750bfda commit e6ed42a
Show file tree
Hide file tree
Showing 139 changed files with 4,067 additions and 3,628 deletions.
30 changes: 15 additions & 15 deletions DESCRIPTION
@@ -1,7 +1,7 @@
Type: Package
Package: dplyr
Title: A Grammar of Data Manipulation
Version: 0.8.0.1
Version: 0.8.1
Authors@R: c(
person("Hadley", "Wickham", , "hadley@rstudio.com", c("aut", "cre"), comment = c(ORCID = "0000-0003-4757-117X")),
person("Romain", "Fran\u00e7ois", role = "aut", comment = c(ORCID = "0000-0002-2444-4226")),
Expand All @@ -14,31 +14,31 @@ Description: A fast, consistent tool for working with data frame like objects,
License: MIT + file LICENSE
URL: http://dplyr.tidyverse.org, https://github.com/tidyverse/dplyr
BugReports: https://github.com/tidyverse/dplyr/issues
Depends: R (>= 3.1.2)
Imports: assertthat (>= 0.2.0), glue (>= 1.1.1), magrittr (>= 1.5),
methods, pkgconfig (>= 2.0.1), R6 (>= 2.2.2), Rcpp (>= 1.0.0),
rlang (>= 0.3.0), tibble (>= 2.0.0), tidyselect (>= 0.2.5),
Depends: R (>= 3.2.0)
Imports: assertthat (>= 0.2.1), glue (>= 1.3.1), magrittr (>= 1.5),
methods, pkgconfig (>= 2.0.2), R6 (>= 2.4.0), Rcpp (>= 1.0.1),
rlang (>= 0.3.4), tibble (>= 2.1.1), tidyselect (>= 0.2.5),
utils
Suggests: bit64 (>= 0.9.7), callr (>= 3.1.1), covr (>= 3.0.1), DBI (>=
0.7.14), dbplyr (>= 1.2.0), dtplyr (>= 0.0.2), ggplot2 (>=
2.2.1), hms (>= 0.4.1), knitr (>= 1.19), Lahman (>= 3.0-1),
Suggests: bit64 (>= 0.9-7), callr (>= 3.2.0), covr (>= 3.2.1), DBI (>=
1.0.0), dbplyr (>= 1.4.0), dtplyr (>= 0.0.3), ggplot2 (>=
3.1.1), hms (>= 0.4.2), knitr (>= 1.22), Lahman (>= 6.0-0),
lubridate (>= 1.7.4), MASS, mgcv (>= 1.8.23), microbenchmark
(>= 1.4.4), nycflights13 (>= 0.2.2), rmarkdown (>= 1.8), RMySQL
(>= 0.10.13), RPostgreSQL (>= 0.6.2), RSQLite (>= 2.0),
testthat (>= 2.0.0), withr (>= 2.1.1), broom (>= 0.5.1), purrr
(>= 0.3.0), readr (>= 1.3.1), crayon (>= 1.3.4)
LinkingTo: BH (>= 1.58.0-1), plogr (>= 0.1.10), Rcpp (>= 1.0.0)
(>= 1.4-6), nycflights13 (>= 1.0.0), rmarkdown (>= 1.12),
RMySQL (>= 0.10.17), RPostgreSQL (>= 0.6-2), RSQLite (>=
2.1.1), testthat (>= 2.1.1), withr (>= 2.1.2), broom (>=
0.5.2), purrr (>= 0.3.2), readr (>= 1.3.1), crayon (>= 1.3.4)
LinkingTo: BH (>= 1.69.0-1), plogr (>= 0.2.0), Rcpp (>= 1.0.1)
VignetteBuilder: knitr
Encoding: UTF-8
LazyData: yes
RoxygenNote: 6.1.1
NeedsCompilation: yes
Packaged: 2019-02-15 15:12:47 UTC; ripley
Packaged: 2019-05-08 09:12:13 UTC; romainfrancois
Author: Hadley Wickham [aut, cre] (<https://orcid.org/0000-0003-4757-117X>),
Romain François [aut] (<https://orcid.org/0000-0002-2444-4226>),
Lionel Henry [aut],
Kirill Müller [aut] (<https://orcid.org/0000-0002-1416-3412>),
RStudio [cph, fnd]
Maintainer: Hadley Wickham <hadley@rstudio.com>
Repository: CRAN
Date/Publication: 2019-02-15 15:30:53 UTC
Date/Publication: 2019-05-14 12:20:03 UTC
270 changes: 134 additions & 136 deletions MD5

Large diffs are not rendered by default.

22 changes: 16 additions & 6 deletions NAMESPACE
Expand Up @@ -72,6 +72,8 @@ S3method(group_by,tbl_cube)
S3method(group_by_,data.frame)
S3method(group_by_,rowwise_df)
S3method(group_by_,tbl_cube)
S3method(group_by_drop_default,default)
S3method(group_by_drop_default,grouped_df)
S3method(group_data,data.frame)
S3method(group_data,grouped_df)
S3method(group_data,rowwise_df)
Expand All @@ -85,10 +87,8 @@ S3method(group_indices_,rowwise_df)
S3method(group_keys,data.frame)
S3method(group_keys,grouped_df)
S3method(group_keys,rowwise_df)
S3method(group_map,"function")
S3method(group_map,data.frame)
S3method(group_map,formula)
S3method(group_map,grouped_df)
S3method(group_modify,data.frame)
S3method(group_modify,grouped_df)
S3method(group_nest,data.frame)
S3method(group_nest,grouped_df)
S3method(group_size,data.frame)
Expand All @@ -102,8 +102,6 @@ S3method(group_trim,grouped_df)
S3method(group_vars,default)
S3method(group_vars,grouped_df)
S3method(group_vars,tbl_cube)
S3method(group_walk,data.frame)
S3method(group_walk,grouped_df)
S3method(groups,data.frame)
S3method(groups,grouped_df)
S3method(groups,tbl_cube)
Expand Down Expand Up @@ -216,6 +214,7 @@ export(arrange_if)
export(as.tbl)
export(as.tbl_cube)
export(as_data_frame)
export(as_label)
export(as_tibble)
export(auto_copy)
export(bench_tbls)
Expand Down Expand Up @@ -302,6 +301,7 @@ export(group_by)
export(group_by_)
export(group_by_all)
export(group_by_at)
export(group_by_drop_default)
export(group_by_if)
export(group_by_prepare)
export(group_cols)
Expand All @@ -310,6 +310,7 @@ export(group_indices)
export(group_indices_)
export(group_keys)
export(group_map)
export(group_modify)
export(group_nest)
export(group_rows)
export(group_size)
Expand Down Expand Up @@ -465,7 +466,16 @@ importFrom(glue,glue)
importFrom(magrittr,"%>%")
importFrom(methods,is)
importFrom(pkgconfig,get_config)
importFrom(rlang,":=")
importFrom(rlang,.data)
importFrom(rlang,as_label)
importFrom(rlang,as_name)
importFrom(rlang,dots_n)
importFrom(rlang,enquo)
importFrom(rlang,enquos)
importFrom(rlang,expr)
importFrom(rlang,sym)
importFrom(rlang,syms)
importFrom(stats,lag)
importFrom(stats,setNames)
importFrom(stats,update)
Expand Down
48 changes: 47 additions & 1 deletion NEWS.md
@@ -1,4 +1,50 @@
# dplyr 0.8.0
# dplyr 0.8.1

## Breaking changes

* `group_modify()` is the new name of the function previously known as `group_map()`

## New functions

* `group_map()` now only calls the function on each group and return a list.

* `group_by_drop_default()`, previously known as `dplyr:::group_drops()` is exported (#4245).

## Minor changes

* Lists of formulas passed to colwise verbs are now automatically named.

* `group_by()` does a shallow copy even in the no groups case (#4221).

* Fixed `mutate()` on rowwise data frames with 0 rows (#4224).

* Fixed handling of bare formulas in colwise verbs (#4183).

* Fixed performance of `n_distint()` (#4202).

* `group_indices()` now ignores empty groups by default for `data.frame`, which is
consistent with the default of `group_by()` (@yutannihilation, #4208).

* Fixed integer overflow in hybrid `ntile()` (#4186).

* colwise functions `summarise_at()` ... can rename vars in the case of multiple functions (#4180).

* `select_if()` and `rename_if()` handle logical vector predicate (#4213).

* hybrid `min()` and `max()` cast to integer when possible (#4258).

* `bind_rows()` correctly handles the cases where there are multiple consecutive `NULL` (#4296).

* Support for R 3.1.* has been dropped. The minimal R version supported is now 3.2.0.
https://www.tidyverse.org/articles/2019/04/r-version-support/

* `rename_at()` handles empty selection (#4324).

# dplyr 0.8.0.1 (2019-02-15)

* Fixed integer C/C++ division, forced released by CRAN (#4185).

# dplyr 0.8.0 (2019-02-14)

## Breaking changes

Expand Down
4 changes: 0 additions & 4 deletions R/RcppExports.R
Expand Up @@ -286,7 +286,3 @@ cummean <- function(x) {
.Call(`_dplyr_cummean`, x)
}

# Register entry points for exported C++ functions
methods::setLoadAction(function(ns) {
.Call('_dplyr_RcppExport_registerCCallable', PACKAGE = 'dplyr')
})
4 changes: 2 additions & 2 deletions R/colwise-filter.R
Expand Up @@ -12,8 +12,8 @@
#' Can also be a function or purrr-like formula. In this case, the
#' intersection of the results is taken by default and there's
#' currently no way to request the union.
#' @param .preserve when `TRUE` (the default), the grouping structure
#' is preserved, otherwise it is recalculated based on the resulting data.
#' @param .preserve when `FALSE` (the default), the grouping structure
#' is recalculated based on the resulting data, otherwise it is kept as is.
#' @export
#'
#' @section Grouping variables:
Expand Down
6 changes: 3 additions & 3 deletions R/colwise-group-by.R
Expand Up @@ -31,7 +31,7 @@
#' d <- tibble(x=c(1,1,2,2), y=c(1,2,1,2))
#' group_by_all(d, as.factor)
#' group_by_if(iris, is.factor, as.character)
group_by_all <- function(.tbl, .funs = list(), ..., .add = FALSE, .drop = group_drops(.tbl)) {
group_by_all <- function(.tbl, .funs = list(), ..., .add = FALSE, .drop = group_by_drop_default(.tbl)) {
funs <- manip_all(.tbl, .funs, enquo(.funs), caller_env(), ...)
if (!length(funs)) {
funs <- syms(tbl_vars(.tbl))
Expand All @@ -40,7 +40,7 @@ group_by_all <- function(.tbl, .funs = list(), ..., .add = FALSE, .drop = group_
}
#' @rdname group_by_all
#' @export
group_by_at <- function(.tbl, .vars, .funs = list(), ..., .add = FALSE, .drop = group_drops(.tbl)) {
group_by_at <- function(.tbl, .vars, .funs = list(), ..., .add = FALSE, .drop = group_by_drop_default(.tbl)) {
funs <- manip_at(.tbl, .vars, .funs, enquo(.funs), caller_env(), .include_group_vars = TRUE, ...)
if (!length(funs)) {
funs <- tbl_at_syms(.tbl, .vars, .include_group_vars = TRUE)
Expand All @@ -49,7 +49,7 @@ group_by_at <- function(.tbl, .vars, .funs = list(), ..., .add = FALSE, .drop =
}
#' @rdname group_by_all
#' @export
group_by_if <- function(.tbl, .predicate, .funs = list(), ..., .add = FALSE, .drop = group_drops(.tbl)) {
group_by_if <- function(.tbl, .predicate, .funs = list(), ..., .add = FALSE, .drop = group_by_drop_default(.tbl)) {
funs <- manip_if(.tbl, .predicate, .funs, enquo(.funs), caller_env(), .include_group_vars = TRUE, ...)
if (!length(funs)) {
funs <- tbl_if_syms(.tbl, .predicate, .include_group_vars = TRUE)
Expand Down
28 changes: 18 additions & 10 deletions R/colwise-mutate.R
Expand Up @@ -278,17 +278,17 @@ manip_all <- function(.tbl, .funs, .quo, .env, ..., .include_group_vars = FALSE)
} else {
syms <- syms(tbl_nongroup_vars(.tbl))
}
funs <- as_fun_list(.funs, .quo, .env, ...)
funs <- as_fun_list(.funs, .env, ...)
manip_apply_syms(funs, syms, .tbl)
}
manip_if <- function(.tbl, .predicate, .funs, .quo, .env, ..., .include_group_vars = FALSE) {
vars <- tbl_if_syms(.tbl, .predicate, .env, .include_group_vars = .include_group_vars)
funs <- as_fun_list(.funs, .quo, .env, ...)
funs <- as_fun_list(.funs, .env, ...)
manip_apply_syms(funs, vars, .tbl)
}
manip_at <- function(.tbl, .vars, .funs, .quo, .env, ..., .include_group_vars = FALSE) {
syms <- tbl_at_syms(.tbl, .vars, .include_group_vars = .include_group_vars)
funs <- as_fun_list(.funs, .quo, .env, ...)
funs <- as_fun_list(.funs, .env, ...)
manip_apply_syms(funs, syms, .tbl)
}

Expand Down Expand Up @@ -317,16 +317,24 @@ check_dot_cols <- function(vars, cols) {
}

manip_apply_syms <- function(funs, syms, tbl) {
stopifnot(is_fun_list(funs))

out <- vector("list", length(syms) * length(funs))
dim(out) <- c(length(syms), length(funs))
syms_position <- match(as.character(syms), tbl_vars(tbl))


for (i in seq_along(syms)) {
pos <- syms_position[i]
for (j in seq_along(funs)) {
var_sym <- sym(syms[[i]])
out[[i, j]] <- expr_substitute(funs[[j]], quote(.), var_sym)
fun <- funs[[j]]
if (is_quosure(fun)) {
out[[i, j]] <- expr_substitute(funs[[j]], quote(.), syms[[i]])
} else {
out[[i, j]] <- call2(funs[[j]], syms[[i]])
}
attr(out[[i, j]], "position") <- pos
}
}

dim(out) <- NULL

# Use symbols as default names
Expand All @@ -336,8 +344,8 @@ manip_apply_syms <- function(funs, syms, tbl) {
if (length(funs) == 1 && !attr(funs, "have_name")) {
names(out) <- names(syms)
} else {
nms <- names(funs)
is_fun <- nms == "<fn>"
nms <- names(funs) %||% rep("<fn>", length(funs))
is_fun <- nms == "<fn>" | nms == ""
nms[is_fun] <- paste0("fn", seq_len(sum(is_fun)))

nms <- unique_names(nms, quiet = TRUE)
Expand All @@ -346,7 +354,7 @@ manip_apply_syms <- function(funs, syms, tbl) {
if (length(syms) == 1 && all(unnamed)) {
names(out) <- names(funs)
} else {
syms_names <- map_chr(syms, as_string)
syms_names <- ifelse(unnamed, map_chr(syms, as_string), names(syms))
grid <- expand.grid(var = syms_names, call = names(funs))
names(out) <- paste(grid$var, grid$call, sep = "_")
}
Expand Down
26 changes: 17 additions & 9 deletions R/colwise-select.R
Expand Up @@ -46,15 +46,15 @@
#' select_all(mtcars)
#' @export
select_all <- function(.tbl, .funs = list(), ...) {
funs <- as_fun_list(.funs, enquo(.funs), caller_env(), ...)
funs <- as_fun_list(.funs, caller_env(), ...)
vars <- tbl_vars(.tbl)
syms <- vars_select_syms(vars, funs, .tbl)
select(.tbl, !!!syms)
}
#' @rdname select_all
#' @export
rename_all <- function(.tbl, .funs = list(), ...) {
funs <- as_fun_list(.funs, enquo(.funs), caller_env(), ...)
funs <- as_fun_list(.funs, caller_env(), ...)
vars <- tbl_vars(.tbl)
syms <- vars_select_syms(vars, funs, .tbl, strict = TRUE)
rename(.tbl, !!!syms)
Expand All @@ -63,17 +63,21 @@ rename_all <- function(.tbl, .funs = list(), ...) {
#' @rdname select_all
#' @export
select_if <- function(.tbl, .predicate, .funs = list(), ...) {
funs <- as_fun_list(.funs, enquo(.funs), caller_env(), ...)
.predicate <- as_fun_list(.predicate, enquo(.predicate), caller_env())
funs <- as_fun_list(.funs, caller_env(), ...)
if (!is_logical(.predicate)) {
.predicate <- as_fun_list(.predicate, caller_env())
}
vars <- tbl_if_vars(.tbl, .predicate, caller_env(), .include_group_vars = TRUE)
syms <- vars_select_syms(vars, funs, .tbl)
select(.tbl, !!!syms)
}
#' @rdname select_all
#' @export
rename_if <- function(.tbl, .predicate, .funs = list(), ...) {
funs <- as_fun_list(.funs, enquo(.funs), caller_env(), ...)
.predicate <- as_fun_list(.predicate, enquo(.predicate), caller_env())
funs <- as_fun_list(.funs, caller_env(), ...)
if (!is_logical(.predicate)) {
.predicate <- as_fun_list(.predicate, caller_env())
}
vars <- tbl_if_vars(.tbl, .predicate, caller_env(), .include_group_vars = TRUE)
syms <- vars_select_syms(vars, funs, .tbl, strict = TRUE)
rename(.tbl, !!!syms)
Expand All @@ -83,15 +87,15 @@ rename_if <- function(.tbl, .predicate, .funs = list(), ...) {
#' @export
select_at <- function(.tbl, .vars, .funs = list(), ...) {
vars <- tbl_at_vars(.tbl, .vars, .include_group_vars = TRUE)
funs <- as_fun_list(.funs, enquo(.funs), caller_env(), ...)
funs <- as_fun_list(.funs, caller_env(), ...)
syms <- vars_select_syms(vars, funs, .tbl)
select(.tbl, !!!syms)
}
#' @rdname select_all
#' @export
rename_at <- function(.tbl, .vars, .funs = list(), ...) {
vars <- tbl_at_vars(.tbl, .vars, .include_group_vars = TRUE)
funs <- as_fun_list(.funs, enquo(.funs), caller_env(), ...)
funs <- as_fun_list(.funs, caller_env(), ...)
syms <- vars_select_syms(vars, funs, .tbl, strict = TRUE)
rename(.tbl, !!!syms)
}
Expand All @@ -104,7 +108,11 @@ vars_select_syms <- function(vars, funs, tbl, strict = FALSE) {
if (is_quosure(fun)) {
fun <- quo_as_function(fun)
}
syms <- set_names(syms(vars), fun(vars))
syms <- if (length(vars)) {
set_names(syms(vars), fun(vars))
} else {
set_names(syms(vars))
}
} else if (!strict) {
syms <- syms(vars)
} else {
Expand Down

0 comments on commit e6ed42a

Please sign in to comment.