R/curate-sparse-roi-data.R

Defines functions curate_sparse_roi_data

#remove data points when the time series is too sparse
curate_sparse_roi_data <- function(
  data,
  window=60,#s
  min_points=20#
){
  t_w = n_points =.N = NULL
  data[, t_w := window * floor(t/window)]
  data[,n_points := .N, by=t_w]
  data <- data[n_points > min_points]
  data[, t_w := NULL]
  data[, n_points := NULL]
  data
}

Try the sleepr package in your browser

Any scripts or data that you put into this service are public.

sleepr documentation built on April 4, 2025, 12:17 a.m.