diff --git a/README.Rmd b/README.Rmd index a9c57b211..bbb12babb 100644 --- a/README.Rmd +++ b/README.Rmd @@ -74,9 +74,6 @@ str(vec_cast_common(FALSE, 1L, 2.5)) The original motivation for vctrs comes from two separate but related problems. The first problem is that `base::c()` has rather undesirable behaviour when you mix different S3 vectors: ```{r} -# combining factors makes integers -c(factor("a"), factor("b")) - # combining dates and date-times gives incorrect values; also, order matters dt <- as.Date("2020-01-01") dttm <- as.POSIXct(dt) diff --git a/README.md b/README.md index 7e85255cd..f5d1edf71 100644 --- a/README.md +++ b/README.md @@ -86,10 +86,6 @@ problems. The first problem is that `base::c()` has rather undesirable behaviour when you mix different S3 vectors: ``` r -# combining factors makes integers -c(factor("a"), factor("b")) -#> [1] 1 1 - # combining dates and date-times gives incorrect values; also, order matters dt <- as.Date("2020-01-01") dttm <- as.POSIXct(dt) diff --git a/vignettes/stability.Rmd b/vignettes/stability.Rmd index d6cf480bb..71aa1db69 100644 --- a/vignettes/stability.Rmd +++ b/vignettes/stability.Rmd @@ -196,18 +196,17 @@ vec_c(Sys.Date(), factor("x"), "x") ### Factors -Combining two factors returns an integer vector: +Prior to 4.1.0 (May 2021), combining two factors returned an integer vector. The current behavior creates a new factor with a combination of factor levels, similar to `vec_c()`. ```{r} fa <- factor("a") fb <- factor("b") c(fa, fb) +c(fb, fa) ``` -(This is documented in `c()` but is still undesirable.) - -`vec_c()` returns a factor taking the union of the levels. This behaviour is motivated by pragmatics: there are many places in base R that automatically convert character vectors to factors, so enforcing stricter behaviour would be unnecessarily onerous. (This is backed up by experience with `dplyr::bind_rows()`, which is stricter and is a common source of user difficulty.) +`vec_c()` also returns a factor taking the union of the levels. This behaviour is motivated by pragmatics: there are many places in base R that automatically convert character vectors to factors, so enforcing stricter behaviour would be unnecessarily onerous. (This is backed up by experience with `dplyr::bind_rows()`, which is stricter and is a common source of user difficulty.) ```{r} vec_c(fa, fb)