Learn R Programming

dataprep (version 0.1.8)

shorvalu: Interpolation with values to refer to within short periods

Description

Performs linear interpolation of missing values within short time segments, constrained by the availability of observed values in the same segment. This method ensures that interpolation is based on nearby valid data.

Usage

shorvalu(data, cols = NULL, intervals = 30, units = "mins",
         date_col = NULL, cores = NULL, verbose = FALSE)

Value

A data frame with missing values filled by linear interpolation within each period.

Arguments

data

A data frame, matrix, or numeric vector. If a vector, simple linear interpolation is applied.

cols

Column indices or names of numeric variables to interpolate. Must be continuous.

intervals

Time gap used to define short periods.

units

Time unit for intervals: "secs", "mins", "hours", "days", "weeks".

date_col

Time column index or name. If NULL, automatically detected.

cores

Number of CPU cores for parallel computation (passed to C++).

verbose

Logical; if TRUE, prints timing and interpolation counts.

Author

Chun-Sheng Liang <[email protected]>

References

1. Example data is from https://smear.avaa.csc.fi/download. It includes particle number concentrations in SMEAR I Varrio forest.

Examples

Run this code
shorvalu(condextr(obsedele(data[1:250, c(1, 4, 17:19)], cols = 3:5, group = 2),
                  cols = 3:5, group = 2),
         cols = 3:5)

Run the code above in your browser using DataLab