diff --git a/NEWS.md b/NEWS.md
index 11973bbd6..88691be4d 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,6 +1,9 @@
# vctrs (development version)
+* `new_vctr()` now inherits from the base type of its input by
+ default.
+
* New performant `data_frame()` constructor for creating data frames in a way
that follows tidyverse semantics. Among other things, inputs are recycled
using tidyverse recycling rules, strings are never converted to factors,
diff --git a/R/type-vctr.R b/R/type-vctr.R
index 97b510f21..e6985675c 100644
--- a/R/type-vctr.R
+++ b/R/type-vctr.R
@@ -67,7 +67,7 @@
new_vctr <- function(.data,
...,
class = character(),
- inherit_base_type = NULL) {
+ inherit_base_type = TRUE) {
if (!is_vector(.data)) {
abort("`.data` must be a vector type.")
}
@@ -78,19 +78,11 @@ new_vctr <- function(.data,
if (is.data.frame(.data)) {
abort("`.data` can't be a data frame.")
}
-
- if (is.null(inherit_base_type)) {
- inherit_base_type <- TRUE
- } else if (is_false(inherit_base_type)) {
+ if (is_false(inherit_base_type)) {
abort("List `.data` must inherit from the base type.")
}
}
- # Default to `FALSE` in all cases except lists
- if (is.null(inherit_base_type)) {
- inherit_base_type <- FALSE
- }
-
class <- c(class, "vctrs_vctr", if (inherit_base_type) typeof(.data))
attrib <- list(names = nms, ..., class = class)
diff --git a/man/new_vctr.Rd b/man/new_vctr.Rd
index 4ea16f68c..4070e1a4e 100644
--- a/man/new_vctr.Rd
+++ b/man/new_vctr.Rd
@@ -5,7 +5,7 @@
\alias{vctr}
\title{vctr (vector) S3 class}
\usage{
-new_vctr(.data, ..., class = character(), inherit_base_type = NULL)
+new_vctr(.data, ..., class = character(), inherit_base_type = TRUE)
}
\arguments{
\item{.data}{Foundation of class. Must be a vector}
diff --git a/revdep/vctrs/README.md b/revdep/vctrs/README.md
index 20f984f40..90cd1e3a2 100644
--- a/revdep/vctrs/README.md
+++ b/revdep/vctrs/README.md
@@ -1,8 +1,17 @@
# Revdeps
-## Failed to check (1)
+## Failed to check (4)
-|package |version |error |warning |note |
-|:-------|:-------|:-----|:-------|:----|
-|drake |? | | | |
+|package |version |error |warning |note |
+|:-----------|:-------|:-----|:-------|:----|
+|codebook |? | | | |
+|drake |? | | | |
+|evaluator |? | | | |
+|salesforcer |? | | | |
+
+## New problems (1)
+
+|package |version |error |warning |note |
+|:--------------------------|:-------|:-----|:-------|:----|
+|[dplyr](problems.md#dplyr) |1.0.1 | |__+3__ |1 |
diff --git a/revdep/vctrs/failures.md b/revdep/vctrs/failures.md
index f322286fb..e8da81e48 100644
--- a/revdep/vctrs/failures.md
+++ b/revdep/vctrs/failures.md
@@ -1,3 +1,80 @@
+# codebook
+
+
+
+* Version: 0.9.2
+* Source code: https://github.com/cran/codebook
+* URL: https://github.com/rubenarslan/codebook
+* BugReports: https://github.com/rubenarslan/codebook/issues
+* Date/Publication: 2020-06-06 23:40:03 UTC
+* Number of recursive dependencies: 192
+
+Run `cloud_details(, "codebook")` for more info
+
+
+
+## Error before installation
+
+### Devel
+
+```
+* using log directory ‘/tmp/workdir/codebook/new/codebook.Rcheck’
+* using R version 3.6.3 (2020-02-29)
+* using platform: x86_64-pc-linux-gnu (64-bit)
+* using session charset: UTF-8
+* using options ‘--no-manual --no-build-vignettes’
+* checking for file ‘codebook/DESCRIPTION’ ... OK
+* this is package ‘codebook’ version ‘0.9.2’
+* package encoding: UTF-8
+* checking package namespace information ... OK
+* checking package dependencies ... ERROR
+Package suggested but not available: ‘psych’
+
+The suggested packages are required for a complete check.
+Checking can be attempted without them by setting the environment
+variable _R_CHECK_FORCE_SUGGESTS_ to a false value.
+
+See section ‘The DESCRIPTION file’ in the ‘Writing R Extensions’
+manual.
+* DONE
+Status: 1 ERROR
+
+
+
+
+
+
+```
+### CRAN
+
+```
+* using log directory ‘/tmp/workdir/codebook/old/codebook.Rcheck’
+* using R version 3.6.3 (2020-02-29)
+* using platform: x86_64-pc-linux-gnu (64-bit)
+* using session charset: UTF-8
+* using options ‘--no-manual --no-build-vignettes’
+* checking for file ‘codebook/DESCRIPTION’ ... OK
+* this is package ‘codebook’ version ‘0.9.2’
+* package encoding: UTF-8
+* checking package namespace information ... OK
+* checking package dependencies ... ERROR
+Package suggested but not available: ‘psych’
+
+The suggested packages are required for a complete check.
+Checking can be attempted without them by setting the environment
+variable _R_CHECK_FORCE_SUGGESTS_ to a false value.
+
+See section ‘The DESCRIPTION file’ in the ‘Writing R Extensions’
+manual.
+* DONE
+Status: 1 ERROR
+
+
+
+
+
+
+```
# drake
@@ -7,7 +84,7 @@
* URL: https://github.com/ropensci/drake, https://docs.ropensci.org/drake, https://books.ropensci.org/drake/
* BugReports: https://github.com/ropensci/drake/issues
* Date/Publication: 2020-06-29 17:20:03 UTC
-* Number of recursive dependencies: 141
+* Number of recursive dependencies: 142
Run `cloud_details(, "drake")` for more info
@@ -74,4 +151,162 @@ Status: 1 ERROR
+```
+# evaluator
+
+
+
+* Version: 0.4.2
+* Source code: https://github.com/cran/evaluator
+* URL: https://evaluator.tidyrisk.org
+* BugReports: https://github.com/davidski/evaluator/issues
+* Date/Publication: 2020-04-16 09:20:09 UTC
+* Number of recursive dependencies: 136
+
+Run `cloud_details(, "evaluator")` for more info
+
+
+
+## Error before installation
+
+### Devel
+
+```
+* using log directory ‘/tmp/workdir/evaluator/new/evaluator.Rcheck’
+* using R version 3.6.3 (2020-02-29)
+* using platform: x86_64-pc-linux-gnu (64-bit)
+* using session charset: UTF-8
+* using options ‘--no-manual --no-build-vignettes’
+* checking for file ‘evaluator/DESCRIPTION’ ... OK
+* this is package ‘evaluator’ version ‘0.4.2’
+* package encoding: UTF-8
+* checking package namespace information ... OK
+* checking package dependencies ... ERROR
+Package suggested but not available: ‘psych’
+
+The suggested packages are required for a complete check.
+Checking can be attempted without them by setting the environment
+variable _R_CHECK_FORCE_SUGGESTS_ to a false value.
+
+See section ‘The DESCRIPTION file’ in the ‘Writing R Extensions’
+manual.
+* DONE
+Status: 1 ERROR
+
+
+
+
+
+
+```
+### CRAN
+
+```
+* using log directory ‘/tmp/workdir/evaluator/old/evaluator.Rcheck’
+* using R version 3.6.3 (2020-02-29)
+* using platform: x86_64-pc-linux-gnu (64-bit)
+* using session charset: UTF-8
+* using options ‘--no-manual --no-build-vignettes’
+* checking for file ‘evaluator/DESCRIPTION’ ... OK
+* this is package ‘evaluator’ version ‘0.4.2’
+* package encoding: UTF-8
+* checking package namespace information ... OK
+* checking package dependencies ... ERROR
+Package suggested but not available: ‘psych’
+
+The suggested packages are required for a complete check.
+Checking can be attempted without them by setting the environment
+variable _R_CHECK_FORCE_SUGGESTS_ to a false value.
+
+See section ‘The DESCRIPTION file’ in the ‘Writing R Extensions’
+manual.
+* DONE
+Status: 1 ERROR
+
+
+
+
+
+
+```
+# salesforcer
+
+
+
+* Version: 0.2.0
+* Source code: https://github.com/cran/salesforcer
+* URL: https://github.com/StevenMMortimer/salesforcer
+* BugReports: https://github.com/StevenMMortimer/salesforcer/issues
+* Date/Publication: 2020-07-21 20:40:03 UTC
+* Number of recursive dependencies: 87
+
+Run `cloud_details(, "salesforcer")` for more info
+
+
+
+## Error before installation
+
+### Devel
+
+```
+* using log directory ‘/tmp/workdir/salesforcer/new/salesforcer.Rcheck’
+* using R version 3.6.3 (2020-02-29)
+* using platform: x86_64-pc-linux-gnu (64-bit)
+* using session charset: UTF-8
+* using options ‘--no-manual --no-build-vignettes’
+* checking for file ‘salesforcer/DESCRIPTION’ ... OK
+* this is package ‘salesforcer’ version ‘0.2.0’
+* package encoding: UTF-8
+* checking package namespace information ... OK
+* checking package dependencies ... ERROR
+Package required but not available: ‘XML’
+
+Package suggested but not available: ‘RForcecom’
+
+The suggested packages are required for a complete check.
+Checking can be attempted without them by setting the environment
+variable _R_CHECK_FORCE_SUGGESTS_ to a false value.
+
+See section ‘The DESCRIPTION file’ in the ‘Writing R Extensions’
+manual.
+* DONE
+Status: 1 ERROR
+
+
+
+
+
+
+```
+### CRAN
+
+```
+* using log directory ‘/tmp/workdir/salesforcer/old/salesforcer.Rcheck’
+* using R version 3.6.3 (2020-02-29)
+* using platform: x86_64-pc-linux-gnu (64-bit)
+* using session charset: UTF-8
+* using options ‘--no-manual --no-build-vignettes’
+* checking for file ‘salesforcer/DESCRIPTION’ ... OK
+* this is package ‘salesforcer’ version ‘0.2.0’
+* package encoding: UTF-8
+* checking package namespace information ... OK
+* checking package dependencies ... ERROR
+Package required but not available: ‘XML’
+
+Package suggested but not available: ‘RForcecom’
+
+The suggested packages are required for a complete check.
+Checking can be attempted without them by setting the environment
+variable _R_CHECK_FORCE_SUGGESTS_ to a false value.
+
+See section ‘The DESCRIPTION file’ in the ‘Writing R Extensions’
+manual.
+* DONE
+Status: 1 ERROR
+
+
+
+
+
+
```
diff --git a/revdep/vctrs/problems.md b/revdep/vctrs/problems.md
index 9a2073633..e4bbe1ade 100644
--- a/revdep/vctrs/problems.md
+++ b/revdep/vctrs/problems.md
@@ -1 +1,41 @@
-*Wow, no problems at all. :)*
\ No newline at end of file
+# dplyr
+
+
+
+* Version: 1.0.1
+* Source code: https://github.com/cran/dplyr
+* URL: https://dplyr.tidyverse.org, https://github.com/tidyverse/dplyr
+* BugReports: https://github.com/tidyverse/dplyr/issues
+* Date/Publication: 2020-07-31 07:00:05 UTC
+* Number of recursive dependencies: 75
+
+Run `cloud_details(, "dplyr")` for more info
+
+
+
+## Newly broken
+
+* checking whether package ‘dplyr’ can be installed ... WARNING
+ ```
+ Found the following significant warnings:
+ Warning: replacing previous import ‘vctrs::data_frame’ by ‘tibble::data_frame’ when loading ‘dplyr’
+ See ‘/tmp/workdir/dplyr/new/dplyr.Rcheck/00install.out’ for details.
+ ```
+
+* checking Rd files ... WARNING
+ ```
+ prepare_Rd: replacing previous import ‘vctrs::data_frame’ by ‘tibble::data_frame’ when loading ‘dplyr’
+ ```
+
+* checking for unstated dependencies in examples ... WARNING
+ ```
+ Warning: replacing previous import ‘vctrs::data_frame’ by ‘tibble::data_frame’ when loading ‘dplyr’
+ ```
+
+## In both
+
+* checking data for non-ASCII characters ... NOTE
+ ```
+ Note: found 4 marked UTF-8 strings
+ ```
+
diff --git a/src/c.c b/src/c.c
index debcdf197..9737131e3 100644
--- a/src/c.c
+++ b/src/c.c
@@ -180,9 +180,7 @@ bool needs_vec_c_fallback(SEXP ptype) {
// Suboptimal: Prevent infinite recursion through `vctrs_vctr` method
SEXP class = PROTECT(Rf_getAttrib(ptype, syms_fallback_class));
- class = r_chr_get(class, r_length(class) - 1);
-
- if (class == strings_vctrs_vctr) {
+ if (r_chr_has_string(class, strings_vctrs_vctr)) {
UNPROTECT(1);
return false;
}
diff --git a/tests/testthat/test-type-vctr.R b/tests/testthat/test-type-vctr.R
index 3465e71fc..248c27c2f 100644
--- a/tests/testthat/test-type-vctr.R
+++ b/tests/testthat/test-type-vctr.R
@@ -2,10 +2,10 @@ context("test-type-vctr")
test_that("constructor sets attributes", {
x <- new_vctr(1:4, class = "x", x = 1)
- expect_equal(x, structure(1:4, class = c("x", "vctrs_vctr"), x = 1))
-
- x <- new_vctr(1:4, class = "x", x = 1, inherit_base_type = TRUE)
expect_equal(x, structure(1:4, class = c("x", "vctrs_vctr", "integer"), x = 1))
+
+ x <- new_vctr(1:4, class = "x", x = 1, inherit_base_type = FALSE)
+ expect_equal(x, structure(1:4, class = c("x", "vctrs_vctr"), x = 1))
})
test_that(".data must be a vector", {