R/compression_helper_functions.R
compression_helper_functions.Rd
These functions can help when compressing vectors. They always compress
their input (x
) into a single element by various means.
compress_with_sum(x)
compress_with_or(x)
The vector to compress
The compressed element
compress_with_sum
computes the sum of the elements, doing its best to
convert all input values to numeric values.
compress_with_or
returns 0
if all elements are FALSE
, 0
, NA
or
empty character values (""
), and 1
otherwise.