| compress_with_sum | R Documentation |
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)
x |
The vector to compress |
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.
The compressed element
rock::compress_with_sum(c(1, '1', 0));
rock::compress_with_or(c(1, '1', 0));
rock::compress_with_or(c(0, '', 0, FALSE));
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.