Be notified of new releases
Create your free GitHub account today to subscribe to this repository for new releases and build software alongside 28 million developers.Sign up
We noticed the following issues during reverse dependencies checks:
reduce()fails with this message:
Error: `.x` is empty, and no `.init` supplied
this is because
empty. Fix the problem by supplying an appropriate argument to
.init, or by providing special behaviour when
.xhas length 0.
The type predicates have been migrated to rlang. Consequently the
bare-type-predicatesdocumentation topic is no longer in purrr,
which might cause a warning if you cross-reference it.
purrr no longer depends on lazyeval or Rcpp (or dplyr, as of the
previous version). This makes the dependency graph of the tidyverse
simpler, and makes purrr more suitable as a dependency of lower-level
There have also been two changes to eliminate name conflicts between
purrr and dplyr:
split_by()have been removed.
dplyr::order_by()and the complete family doesn't feel that
useful. Use tibbles instead (#217).
contains()has been renamed to
has_element()to avoid conflicts with
The plucking mechanism used for indexing into data structures with
map() has been extracted into the function
pluck(). Plucking is
often more readable to extract an element buried in a deep data
structure. Compare this syntax-heavy extraction which reads
to the equivalent pluck:
x %>% pluck(1, accessor, "foo")
as_mapper()because it is a tranformation that
makes sense primarily for mapping functions, not in general (#298).
.nullhas been renamed to
.defaultto better reflect its intent (#298).
.defaultis returned whenever an element is absent or empty (#231, #254).
as_mapper()sanitises primitive functions by transforming them to
closures with standardised argument names (using
+is transformed to
function(.x, .y) .x + .y. This
results in proper argument matching so that
, .x = 5))produces
list(5 - 1, 5 - 2, ...).
attr_getter()makes it possible to extract from attributes
map(list(iris, mtcars), attr_getter("row.names")).
The argument list for formula-functions has been tweaked so that you can
refer to arguments by position with
..2, and so on. This makes it
possible to use the formula shorthand for functions with more than two
safely()and friends no longer capture interrupts: this
means that you can now terminate a mapper using one of these with
Escape or Ctrl + C (#314)
All map functions now treat
NULLthe same way as an empty vector (#199),
and return an empty vector if any input is an empty vector.
map()functions now force their arguments in the same way that base R
lapply()(#191). This makes
map()etc easier to use when
A new family of "indexed" map functions,
provide a short-hand for
The data frame suffix
_dfhas been (soft) deprecated in favour of
_dfrto more clearly indicate that it's a row-bind. All variants now
also have a
_dfcfor column binding (#167). (These will not be terribly
semantics for vectors.)
modify() family returns the same output of the type as the
.x. This is in contrast to the
map() family which always
returns a list, regardless of the input type.
The modify functions are S3 generics. However their default methods
should be sufficient for most classes since they rely on the semantics
modify.default() is thus a shorthand for
x <- map(x, f).
at_depth()has been renamed to
.raggedargument, and negative depths are
now computed relative to the deepest component of the list (#236).
auto_browse(f)returns a new function that automatically calls
fthrows an error (#281).
vec_depth()computes the depth (i.e. the number of levels of indexing)
or a vector (#243).
reduce2_right()make it possible to reduce with a
3 argument function where the first argument is the accumulated value, the
second argument is
.x, and the third argument is
The legacy function
update_list()is basically a version of
list_modifythat evaluates formulas within the list. It is likely
to be deprecated in the future in favour of a tidyeval interface
such as a list method for
Minor improvements and bug fixes
Thanks to @dchiu911, the unit test coverage of purrr is now much greater.
All predicate functions are re-exported from rlang (#124).
compact()now works with standard mapper conventions (#282).
cross_n()has been renamed to
removed for consistency with
at the start of the project) and
cross_d()has been renamed to
for consistency with
NAif present in the input (#174).
invoke()uses a more robust approach to generate the argument list (#249)
It no longer uses lazyeval to figure out which enviroment a character
is_scalar_numeric()are deprecated because they
don't test for what you might expect at first sight.
reduce()now throws an error if
.xis empty and
zip_n()have been removed.
pmap()coerces data frames to lists to avoid the expensive
which provides security that is unneeded here (#220).
rdunif()checks its inputs for validity (#211).
set_names()can now take a function to tranform the names programmatically
(#276), and you can supply names in
...to reduce typing even more
set_names()is now powered by
safely()now actually uses the
transpose()now matches by name if available (#164). You can
override the default choice with the new
The function argument of
.f. This is because they have mapper
semantics rather than predicate semantics.