file = system.file("extdata/P30_wrist100.csv.gz", package = "stepcount")
if (stepcount_check()) {
out = stepcount(file = file)
st = out$step_times
}
if (FALSE) {
file = system.file("extdata/P30_wrist100.csv.gz", package = "stepcount")
df = readr::read_csv(file)
if (stepcount_check()) {
out = stepcount(file = df)
st = out$step_times
}
if (requireNamespace("ggplot2", quietly = TRUE) &&
requireNamespace("tidyr", quietly = TRUE) &&
requireNamespace("dplyr", quietly = TRUE)) {
dat = df[10000:12000,] %>%
dplyr::select(-annotation) %>%
tidyr::gather(axis, value, -time)
st = st %>%
dplyr::mutate(time = lubridate::as_datetime(time)) %>%
dplyr::as_tibble()
st = st %>%
dplyr::filter(time >= min(dat$time) & time <= max(dat$time))
dat %>%
ggplot2::ggplot(ggplot2::aes(x = time, y = value, colour = axis)) +
ggplot2::geom_line() +
ggplot2::geom_vline(data = st, ggplot2::aes(xintercept = time))
}
}
Run the code above in your browser using DataLab