Learn R Programming

bettermc (version 1.2.1)

compress_chars: Recursively Call char_map/map2char on a List

Description

These originally internal functions are exported because they are also useful for reducing the size of e.g. a data frame before storing it to disk using saveRDS. This also improves the (de)serialization speed.

Usage

compress_chars(
  l,
  limit = 0L,
  compress_altreps = c("if_allocated", "yes", "no"),
  class = character()
)

uncompress_chars(l, class = character())

Value

For compress_chars, l, but with character vectors replaced by objects of class char_map. For

uncompress_chars, l, but with all

char_map-objects, which also inherit from all classes given in class, replaced by the original character vectors.

Arguments

l

an object, typically a list

limit

the minimum length of a character vector for char_map to be applied

compress_altreps

should a character vector be compressed if it is an ALTREP? The default "if_allocated" only does so if the regular representation was already created. This was chosen as the default because in this case is is the regular representation which would be serialized.

class

additional classes to set on the char_map-objects created by compress_chars. For uncompress_chars, only call map2char on those char_map-objects which additionally inherit from all these classes.

Windows Support

Fully supported on Windows.

Lifecycle

[Experimental]