Skip to content

cheapr 1.5.0

Choose a tag to compare

@NicChr NicChr released this 02 Apr 08:48

cheapr 1.5.0 supersedes cheapr 1.4.0

The C/C++ API is currently under development and a
stable release can be expected for cheapr 2.0.0

Note: cheapr 2.0.0 will require C++20

General news

  • Thanks @ChampLeeTX for spotting an issue where the package
    wasn't installing for older versions of R. This is now fixed.

  • A new rich set of parallelised math functions like abs_, round_ and more.

  • New functions for setting and getting the number of threads being used.

  • New multi-threaded vector initialisers like new_integer and new_double.

  • Plain list vectors are now never regarded as NA even if they contain NA
    elements.

  • Parallelisation is internally used more frequently for operations like
    creating new vectors, combining vectors, filling, copying and replacing data.
    The default has been changed to 2. To use a different number of threads simply
    use set_threads()

  • scm now better detects when integer (32-bit and 64-bit) overflow occurs and
    switches to using doubles internally, returning a double value.

  • if_else_ can now handle data frames and is fully SIMD parallelised.

New features

  • The C/C++ API has been re-written to use pure R C API code internally.

  • New function unique_ as a cheaper alternative to unique.

  • New function replace_, a cheaper alternative to [<- for fast
    value replacement.

  • New functions cast, cast_common, archetype, archetype_common, r_type
    and r_type_common to help with fast type-stable coercion.

  • paste_ as a fast alternative to base::paste.

  • New function na_init to help with fast initialisation of vectors based off
    a template vector.

  • seq_ gains a new argument size to allow for specifying sequences
    of exact sizes.
    Any combination of from, to, by and size can be specified and are
    vectorised.

  • Added argument as_list to seq_ and sequence_ to allow the
    result to be returned as a list of sequences instead of a vector of combined
    sequences.

  • New vectorised functions seq_start, seq_end and seq_increment to help
    with sequence generation.

  • New function is_whole_number to check that a numeric vector consists
    only of whole numbers.

  • New function switch_args to give more flexibility to developers creating
    functions that accept the ... argument.

  • Exported cpp_rebuild, a low-level convenience function for rebuilding
    attributes from a template.

  • New rebuild methods for tbl_df and sf objects.

Bug fixes

  • Fixed a bug in case that would return incorrect results when the length of
    the RHS was greater than 1.

  • Removed all non-API C entry points.

Changes and Improvements

  • sset is no longer an S3 generic and now internally dispatches on the
    correct method. One can still define a subset method for custom objects
    via [ which sset falls back on when it can't find an appropriate method.

  • Combining vectors via c_ has been internally made simpler, faster and
    utilises type-stable common-casting.

  • if_else_ has been re-written mostly in C/C++ and should be faster.

  • as_df has been re-written in C/C++ and now has much lower overhead.

  • The .args argument now accepts any list, even classed ones.

  • rebuild.data.frame and rebuild.data.table will now return a data frame
    with class 'data.frame' and c('data.table', 'data.frame') respectively instead of
    returning a data frame with the class of the template data frame.

  • Added aliases for all functions named 'cheapr_' to follow the convention of
    fn_() where fn() is the common function they are replacing or improving.
    The current alternatives beginning with 'cheapr_' will likely not be deprecated
    for a long while.

  • sequence_ will now recycle the size argument additionally to recycling
    from and by.

  • Subsetting sf objects with sset now internally calls [.

Breaking changes

  • fastplyr versions 0.9.91 and later must depend on cheapr version 1.4.0 and
    later. This means that you can't for example install both fastplyr 0.9.9 and
    cheapr 1.3.2

  • Matrices and arrays are explicitly converted to vectors
    when using data frames via new_df and other data frame constructors.
    Since the internal structure of a matrix is a vector with dimension attributes
    it is much more efficient to treat it as a vector.
    To work with rectangular data in cheapr it is advised to use data frames.

  • enframe_(), deframe_() and cut_numeric() have been removed as they have
    been deprecated for a while.