fix_zeros: Fix Zeros from Idle Sleep Mode

View source: R/fix_zeros.R

fix_zerosR Documentation

Fix Zeros from Idle Sleep Mode

Description

Fix Zeros from Idle Sleep Mode

Usage

fix_zeros(df, fill_in = TRUE, by_second = FALSE, trim = FALSE)

idle_na_locf(df, by_second = FALSE)

Arguments

df

An object with columns 'X', 'Y', and 'Z' or an object of class 'AccData'

fill_in

Should the zeros be filled in with the last observation carried forward?

by_second

Should the last observation carried forward be done only within the same second?

trim

Should the time course be trimmed for zero values at the beginning and the end of the time course?

Value

A data set with the zeros filled in

Examples

df = data.frame(
  X = c(0.3/sqrt(0.5), rep(0, 3)),
  Y = c(0.4/sqrt(0.5), rep(0, 3)),
  Z = c(0.5/sqrt(0.5), rep(0, 3)),
  stringsAsFactors = FALSE)
fix_zeros(df)
fix_zeros(df, fill_in = FALSE)
fix_zeros(df, trim = TRUE)
df$time = c(1,3,2, 4)
fix_zeros(df)
acc = list(header = NULL,
data = df
)
class(acc) = "AccData"
idle_na_locf(acc)
fix_zeros(acc, trim = TRUE)

muschellij2/SummarizedActigraphy documentation built on Aug. 12, 2024, 5:35 p.m.