Skip to content

vctrs 0.3.3

Compare
Choose a tag to compare
@lionel- lionel- released this 28 Aug 12:20
  • The table class is now implemented as a wrapper type that
    delegates its coercion methods. It used to be restricted to integer
    tables (#1190).

  • Named one-dimensional arrays now behave consistently with simple
    vectors in vec_names() and vec_rbind().

  • new_rcrd() now uses df_list() to validate the fields. This makes
    it more flexible as the fields can now be of any type supported by
    vctrs, including data frames.

  • Thanks to the previous change the [[ method of records now
    preserves list fields (#1205).

  • vec_data() now preserves data frames. This is consistent with the
    notion that data frames are a primitive vector type in vctrs. This
    shouldn't affect code that uses [[ and length() to manipulate
    the data. On the other hand, the vctrs primitives like vec_slice()
    will now operate rowwise when vec_data() returns a data frame.

  • outer is now passed unrecycled to name specifications. Instead,
    the return value is recycled (#1099).

  • Name specifications can now return NULL. The names vector will
    only be allocated if the spec function returns non-NULL during the
    concatenation. This makes it possible to ignore outer names without
    having to create an empty names vector when there are no inner
    names:

    zap_outer_spec <- function(outer, inner) if (is_character(inner)) inner
    
    # `NULL` names rather than a vector of ""
    names(vec_c(a = 1:2, .name_spec = zap_outer_spec))
    #> NULL
    
    # Names are allocated when inner names exist
    names(vec_c(a = 1:2, c(b = 3L), .name_spec = zap_outer_spec))
    #> [1] ""  ""  "b"
    
  • Fixed several performance issues in vec_c() and vec_unchop()
    with named vectors.

  • The restriction that S3 lists must have a list-based proxy to be considered
    lists by vec_is_list() has been removed (#1208).

  • 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,
    list-columns are easier to create, and unnamed data frame input is
    automatically spliced.

  • New df_list() for safely and consistently constructing the data structure
    underlying a data frame, a named list of equal-length vectors. It is useful
    in combination with new_data_frame() for creating user-friendly
    constructors for data frame subclasses that use the tidyverse rules for
    recycling and determining types.

  • Fixed performance issue with vec_order() on classed vectors which
    affected dplyr::group_by() (tidyverse/dplyr#5423).

  • vec_set_names() no longer alters the input in-place (#1194).

  • New vec_proxy_order() that provides an ordering proxy for use in
    vec_order() and vec_sort(). The default method falls through to
    vec_proxy_compare(). Lists are special cased, and return an integer
    vector proxy that orders by first appearance.

  • List columns in data frames are no longer comparable through vec_compare().

  • The experimental relax argument has been removed from
    vec_proxy_compare().