vctrs
vctrs copied to clipboard
Generic programming with typed R vectors
Once the semantics of `vec_is()` are fixed (#1687), explore whether we can improve performance of common type determination of the elements of homogeneous lists by using `vec_is()`.
We could make `vec_is()` generic by requiring the result of `vec_ptype()` to only contain essential attributes. Methods for `vec_ptype()` would need to remove any details attributes. Ideally they'd just return...
Subsetting and subassignment is up to 5x slower than the corresponding data frame operations. I don't see potential to optimize at the R level without compromising readability. To implement efficiently...
I have isolated a function in tibble that implements clean subset assignment, without tibble's quirks. This function could move to vctrs, and be reimplemented here in C. The R code...
``` r vctrs::vec_ptype_common(table(rpois(10, 1)), 1, 2) #> Error: #> ! Can't combine `..1` and `..2` . ``` Created on 2022-09-23 with [reprex v2.0.2](https://reprex.tidyverse.org) Feels like it might be too much...
I think I need some help here. I have defined `vec_restore()` for the tsibble object, which solves the attribute updating issue when `vec_slice()` a tsibble. But it breaks `bind_rows()` that...
Missing: ```r vec_cast.double.complex vec_cast.logical.complex vec_cast.integer.complex ``` We have: ```r vec_cast.complex.double vec_cast.complex.logical vec_cast.complex.integer ``` These methods would only be lossless if the complex doesn't have an imaginary part.
When trying to `View()` a data frame with a `vctrs_rcrd`-type column in RStudio the attempt fails with the error: "Error: Can't cast `x` to `to` ." It works with `vctrs_vctr`...
i.e. compress a numeric vector using rle. `vec_proxy()` and `vec_restore()` are trivial to implement, but you can get better performance for (e.g. `vec_match()`) by implementing a specific method.
In practice attributes are an unordered type.