Skip to content

Commit

Permalink
Move towards vctrs coercion rules (#914)
Browse files Browse the repository at this point in the history
Fixes #904
  • Loading branch information
hadley authored Sep 8, 2022
1 parent c3ad48c commit d2896e2
Show file tree
Hide file tree
Showing 15 changed files with 1,947 additions and 230 deletions.
16 changes: 16 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,22 @@

## Features and fixes

* `_lgl()`, `_int()`, `_int()`, and `_dbl()` now use the same (strict) coercion
methods as vctrs (#904). This means that:

* `map_chr(TRUE, identity)`, `map_chr(0L, identity)`, and
`map_chr(1L, identity)` are deprecated because we now believe that
converting a logical/integer/double to a character vector should require
an explicit coercion.

* `map_dbl(1.5, identity)` now fails because we believe that silently
truncating doubles to integers is dangerous. But note that
`map_dbl(1, identity)` still works since no numeric precision is lost.

* `map_int(c(TRUE, FALSE), identity)`, `map_dbl(c(TRUE, FALSE), identity)`,
`map_lgl(c(1L, 0L), identity)` and `map_lgl(c(1, 0), identity)` now
succeed because 1/TRUE and 0/FALSE should be interchangeable.

* `pluck<-`/`assign_in()` can now modify non-existing locations (#704).

* `pluck<-`/`assign_in()` now sets elements to `NULL` rather than removing them
Expand Down
11 changes: 10 additions & 1 deletion R/coerce.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,13 @@ coerce_lgl <- function(x) coerce(x, "logical")
coerce_int <- function(x) coerce(x, "integer")
coerce_dbl <- function(x) coerce(x, "double")
coerce_chr <- function(x) coerce(x, "character")
coerce_raw <- function(x) coerce(x, "raw")


deprecate_to_char <- function(type) {
lifecycle::deprecate_warn(
"0.4.0",
I(paste0("Automatical coercion from ", type, " to character")),
I("an explicit call to as.character() within map_chr()"),
always = TRUE
)
}
4 changes: 1 addition & 3 deletions R/map.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@
#' named if the input was named.
#'
#' * `_lgl`, `_int`, `_dbl`, `_chr` return a logical, integer, double,
#' or character vector respectively. The output of `.f` will only be
#' automatically coerced upwards (i.e. logical -> integer -> double ->
#' character). It will be named if the input was named.
#' or character vector respectively. It will be named if the input was named.
#'
#' * `_dfc` and `_dfr()` all return a data frame created by row-binding and
#' column-binding respectively. They require dplyr to be installed.
Expand Down
4 changes: 1 addition & 3 deletions man/map.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions man/map2.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions man/pmap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 44 additions & 21 deletions revdep/README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,50 @@
# Revdeps

## Failed to check (3)
## Failed to check (7)

|package |version |error |warning |note |
|:------------|:-------|:-----|:-------|:----|
|elbird |0.2.5 |1 | | |
|ggPMX |? | | | |
|ImputeRobust |? | | | |
|package |version |error |warning |note |
|:------------|:-------|:------|:-------|:----|
|elbird |0.2.5 |1 | | |
|ggPMX |? | | | |
|ImputeRobust |? | | | |
|[kerastuneR](failures.md#kerastuner)|0.1.0.5 |__+1__ | |-1 |
|[rATTAINS](failures.md#rattains)|0.1.3 |__+1__ | | |
|[stoRy](failures.md#story)|0.2.0 |__+1__ | | |
|[tidyjson](failures.md#tidyjson)|0.3.1 |__+1__ | | |

## New problems (12)
## New problems (31)

|package |version |error |warning |note |
|:------------------------------------------|:-------|:------|:-------|:--------|
|[cattonum](problems.md#cattonum) |0.0.5 | | |1 __+1__ |
|[dibble](problems.md#dibble) |0.2.1 |__+1__ | | |
|[epitopR](problems.md#epitopr) |0.1.1 |__+1__ |1 |1 |
|[gghighlight](problems.md#gghighlight) |0.3.3 | |__+1__ | |
|[gratia](problems.md#gratia) |0.7.3 |__+1__ | | |
|[grizbayr](problems.md#grizbayr) |1.3.2 |__+1__ | | |
|[gwasrapidd](problems.md#gwasrapidd) |0.99.13 |__+1__ | | |
|[partialised](problems.md#partialised) |0.1.0 |__+1__ | | |
|[rATTAINS](problems.md#rattains) |0.1.3 |__+1__ |__+1__ | |
|[ruta](problems.md#ruta) |1.1.0 |__+2__ |__+1__ |1 |
|[sbm](problems.md#sbm) |0.4.4 |__+1__ | | |
|[tidywikidatar](problems.md#tidywikidatar) |0.5.4 |__+1__ | | |
|package |version |error |warning |note |
|:-------------------|:-------|:---------|:-------|:--------|
|[autothresholdr](problems.md#autothresholdr)|1.4.0 | |__+1__ | |
|[campsis](problems.md#campsis)|1.3.0 |__+1__ |__+1__ | |
|[casino](problems.md#casino)|0.1.0 | |__+1__ |2 |
|[cattonum](problems.md#cattonum)|0.0.5 | | |1 __+1__ |
|[csvwr](problems.md#csvwr)|0.1.6 |__+1__ | | |
|[dibble](problems.md#dibble)|0.2.1 |__+1__ | | |
|[egor](problems.md#egor)|1.22.5 |__+2__ | | |
|[emba](problems.md#emba)|0.1.8 |__+1__ | |1 |
|[escalation](problems.md#escalation)|0.1.4 |__+1__ |__+1__ |2 |
|[eventr](problems.md#eventr)|1.0.0 |__+1__ | |1 |
|[ffscrapr](problems.md#ffscrapr)|1.4.7 |__+1__ |__+1__ |1 |
|[gghighlight](problems.md#gghighlight)|0.3.3 | |__+1__ | |
|[gratia](problems.md#gratia)|0.7.3 |__+1__ | | |
|[grizbayr](problems.md#grizbayr)|1.3.2 |__+1__ | | |
|[gwasrapidd](problems.md#gwasrapidd)|0.99.13 |__+1__ | | |
|[healthcareai](problems.md#healthcareai)|2.5.1 | | |__+1__ |
|[immunarch](problems.md#immunarch)|0.7.0 |__+1__ | |1 |
|[linea](problems.md#linea)|0.0.3 |-1 __+1__ | | |
|[mskcc.oncotree](problems.md#mskcconcotree)|0.1.0 |__+1__ | |1 |
|[partialised](problems.md#partialised)|0.1.0 |__+1__ | | |
|[PHEindicatormethods](problems.md#pheindicatormethods)|1.4.1 |__+2__ | | |
|[PLNmodels](problems.md#plnmodels)|0.11.7 |__+1__ |__+1__ |1 |
|[quincunx](problems.md#quincunx)|0.1.5 |__+2__ | | |
|[rb3](problems.md#rb3)|0.0.6 |__+1__ |__+1__ | |
|[ruta](problems.md#ruta)|1.1.0 |__+2__ |__+1__ |1 |
|[sbm](problems.md#sbm)|0.4.4 |__+1__ | | |
|[scrutiny](problems.md#scrutiny)|0.2.2 |__+1__ |__+1__ | |
|[tidybins](problems.md#tidybins)|0.1.0 |__+1__ | |1 |
|[tidywikidatar](problems.md#tidywikidatar)|0.5.4 |__+1__ | | |
|[TT](problems.md#tt)|0.98 |__+1__ | | |
|[varsExplore](problems.md#varsexplore)|0.3.0 |__+1__ |__+1__ |2 |

80 changes: 75 additions & 5 deletions revdep/cran.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,52 @@
## revdepcheck results

We checked 1345 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.
We checked 1373 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package.

* We saw 12 new problems
* We failed to check 3 packages
* We saw 31 new problems
* We failed to check 7 packages

Issues with CRAN packages are summarised below.

### New problems
(This reports the first line of each new failure)

* autothresholdr
checking re-building of vignette outputs ... WARNING

* campsis
checking tests ... ERROR
checking re-building of vignette outputs ... WARNING

* casino
checking re-building of vignette outputs ... WARNING

* cattonum
checking R code for possible problems ... NOTE

* csvwr
checking tests ... ERROR

* dibble
checking tests ... ERROR

* epitopR
* egor
checking examples ... ERROR
checking tests ... ERROR

* emba
checking tests ... ERROR

* escalation
checking examples ... ERROR
checking re-building of vignette outputs ... WARNING

* eventr
checking examples ... ERROR

* ffscrapr
checking tests ... ERROR
checking re-building of vignette outputs ... WARNING

* gghighlight
checking re-building of vignette outputs ... WARNING

Expand All @@ -31,10 +59,34 @@ Issues with CRAN packages are summarised below.
* gwasrapidd
checking tests ... ERROR

* healthcareai
checking R code for possible problems ... NOTE

* immunarch
checking examples ... ERROR

* linea
checking tests ... ERROR

* mskcc.oncotree
checking examples ... ERROR

* partialised
checking tests ... ERROR

* rATTAINS
* PHEindicatormethods
checking examples ... ERROR
checking tests ... ERROR

* PLNmodels
checking tests ... ERROR
checking re-building of vignette outputs ... WARNING

* quincunx
checking examples ... ERROR
checking tests ... ERROR

* rb3
checking tests ... ERROR
checking re-building of vignette outputs ... WARNING

Expand All @@ -46,11 +98,29 @@ Issues with CRAN packages are summarised below.
* sbm
checking tests ... ERROR

* scrutiny
checking examples ... ERROR
checking re-building of vignette outputs ... WARNING

* tidybins
checking examples ... ERROR

* tidywikidatar
checking examples ... ERROR

* TT
checking examples ... ERROR

* varsExplore
checking examples ... ERROR
checking re-building of vignette outputs ... WARNING

### Failed to check

* elbird (NA)
* ggPMX (NA)
* ImputeRobust (NA)
* kerastuneR (NA)
* rATTAINS (NA)
* stoRy (NA)
* tidyjson (NA)
Loading

0 comments on commit d2896e2

Please sign in to comment.