Learn R Programming

tagtools (version 0.2.0)

interp_nan: Remove NAs from sensor data and return indices of (rows of) filled values

Description

This is an internal function used by htrack

Usage

interp_nan(data)

Value

A list with entries data (the input data with NAs filled in) and k a logical vector indicating the position (if data was a vector) or rows (if data was a matrix) where NAs were filled in. Internal NAs are filled via linear interoplation, while leading and trailing ones are filled using the first following or last preceding good value.

Arguments

data

a data vector or matrix

Examples

Run this code
A <- matrix(c(NA, NA, 3, 4, 5, 6, 7, 8, 9, 10, NA, NA, 13, 14, 15, 16, NA, NA), ncol = 2)
result <- interp_nan(A)

Run the code above in your browser using DataLab