Skip to content

Commit

Permalink
Revert #237 to avoid haven issue
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Feb 29, 2020
1 parent efb04af commit 4a5095d
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 72 deletions.
3 changes: 1 addition & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# forcats (development version)

* `as_factor()` gains a logical method that always returns a factor with
levels "FALSE" and "TRUE" (#185), and converts ordered factors into plain
factor (@robinson_es, #216).
levels "FALSE" and "TRUE" (#185).

* `fct_c()`, `fct_collapse()` and `fct_recode()` are now explicitly
documented as using [dynamic dots](https://rlang.r-lib.org/reference/dyn-dots.html)
Expand Down
7 changes: 1 addition & 6 deletions R/as_factor.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@ as_factor <- function(x, ...) {
#' @rdname as_factor
#' @export
as_factor.factor <- function(x, ...) {
structure(
x,
class = "factor",
label = attr(x, "label", exact = TRUE),
levels = attr(x, "levels", exact = TRUE)
)
x
}

#' @rdname as_factor
Expand Down
8 changes: 1 addition & 7 deletions revdep/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
|collate |en_US.UTF-8 |
|ctype |en_US.UTF-8 |
|tz |America/Chicago |
|date |2020-02-28 |
|date |2020-02-29 |

# Dependencies

Expand All @@ -34,9 +34,3 @@

# Revdeps

## New problems (1)

|package |version |error |warning |note |
|:--------------------------|:-------|:------|:-------|:----|
|[haven](problems.md#haven) |2.2.0 |__+1__ | |2 |

52 changes: 1 addition & 51 deletions revdep/problems.md
Original file line number Diff line number Diff line change
@@ -1,51 +1 @@
# haven

<details>

* Version: 2.2.0
* Source code: https://github.com/cran/haven
* URL: http://haven.tidyverse.org, https://github.com/tidyverse/haven, https://github.com/WizardMac/ReadStat
* BugReports: https://github.com/tidyverse/haven/issues
* Date/Publication: 2019-11-08 06:20:22 UTC
* Number of recursive dependencies: 59

Run `revdep_details(,"haven")` for more info

</details>

## Newly broken

* checking tests ...
```
ERROR
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
> library(testthat)
> library(haven)
>
> test_check("haven")
── 1. Failure: leaves factors unchanged (@test-as-factor.R#7)  ────────────────────────────────────────────────────
as_factor(f) not equal to `f`.
Attributes: < Component "class": Lengths (1, 2) differ (string compare on first 1) >
Attributes: < Component "class": 1 string mismatch >
══ testthat results ══════════════════════════════════════════════════════════════════════════════════════════════
[ OK: 269 | SKIPPED: 0 | WARNINGS: 0 | FAILED: 1 ]
1. Failure: leaves factors unchanged (@test-as-factor.R#7)
Error: testthat unit tests failed
Execution halted
```
## In both
* checking Rd cross-references ... NOTE
```
Package unavailable to check Rd xrefs: ‘dplyr’
```
* checking for GNU extensions in Makefiles ... NOTE
```
GNU make is a SystemRequirements.
```
*Wow, no problems at all. :)*
6 changes: 0 additions & 6 deletions tests/testthat/test-as_factor.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,3 @@ test_that("supports NA (#89)", {
x <- c("a", "z", "g", NA)
expect_equal(as_factor(x), fct_inorder(x))
})

test_that("converts ordered factor into plain factor (#216)", {
x <- factor(c("a", "z", "g"), ordered = TRUE)
x <- as_factor(x)
expect_s3_class(as_factor(x), "factor", exact = "TRUE")
})

0 comments on commit 4a5095d

Please sign in to comment.