View source: R/op_interpolate.R
op_interpolate | R Documentation |
This function performs interpolation for x and y coordinate columns in a dataset
based on confidence thresholds. It groups the data by person
and region
and
uses spline interpolation to estimate missing or low-confidence values.
op_interpolate(
data,
confidence_threshold,
missing = TRUE,
treat_na_conf_as_low = FALSE
)
data |
A data frame containing x, y, confidence columns, and grouping columns ( |
confidence_threshold |
A numeric value specifying the confidence threshold below which values will be interpolated. |
missing |
Logical. If TRUE, interpolate missing values ( |
treat_na_conf_as_low |
Logical. If TRUE, treat NA in the confidence column as low confidence. |
A modified data frame with interpolated x and y values for low-confidence or missing rows.
# Load example data from the package
data_path <- system.file("extdata/csv_data/A-B_body_dyad.csv", package = "duet")
data <- read.csv(data_path)
# Interpolate missing or low-confidence values
result <- op_interpolate(
data = data,
confidence_threshold = 0.5,
missing = TRUE,
treat_na_conf_as_low = TRUE
)
print(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.