squeeze | R Documentation |
This acts similar to base::toString()
function, but it tries to
make the string as short as possible by squeezing sequences of integers into
boundary values only. Please see the examples section. unsqueeze()
reverses this operation.
squeeze(integers)
unsqueeze(strings, strict = FALSE)
integers |
a numeric vector of integers. |
strings |
a character vector of strings, preferably outputs of
|
strict |
a logical value, decides whether the output should be strictly
a list. If |
squeeze
returns a vector of characters, unsqueeze
returns a list of numerics or a numeric vector.
Jakub Bujnowicz bujnowiczgithub@gmail.com
integers <- c(1, 3:5, NA, 27:38, 10:13, 9:11, 6)
squeeze(integers)
unsqueeze(squeeze(integers))
setdiff(na.omit(integers), unsqueeze(squeeze(integers)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.