R: Fill out missing values by interpolation

tween_fill {tweenr} | R Documentation

## Fill out missing values by interpolation

### Description

This tween fills out `NA` elements (or `NULL` elements if `data` is a list) by interpolating between the prior and next non-missing values.

### Usage

    tween_fill(data, ease)

### Arguments

`data` | A data.frame or vector.
`ease` | A character vector giving valid easing functions. Recycled to match the ncol of `data`

### Value

If `data` is a data.frame then a data.frame with the same columns. If `data` is a vector then a vector.

### Examples

    # Single vector
    tween_fill(c(1, NA, NA, NA, NA, NA, 2, 6, NA, NA, NA, -2), 'cubic-in-out')

    # Data frame
    tween_fill(mtcars[c(1, NA, NA, NA, NA, 4, NA, NA, NA, 10), ], 'cubic-in')

[Package tweenr version 1.0.2 Index]