Apply a function raggedly to a vector containing NAs.
Each consecutive stretch of non-NA values is treated as a separate input to the function (using
Can be used as a generalised method for functions that don't have a
na.omit option or when
it's important to maintain data structure and order.
The function is best used for
FUNs which return an output of the same size as the input.
FUN returns an atomic value for an input vector (eg
mean) the output is replicated across
all entries of x as necessary.
A vector of the same size and NA distribution as
x but containing
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.