---
title: "actimetrics workflow"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{actimetrics workflow}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r setup, include = FALSE}
library(actimetrics)
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

`actimetrics` bundles a small set of actigraphy helpers for raw preprocessing,
summary metrics, count overlays, and MIMS-oriented processing.

## Read data

```{r}
path <- actiread::acti_example_gt3x()
data <- actiread::acti_read_gt3x(path, verbose = FALSE)
data <- data[1:12000, ]
```

## Summary metrics

```{r}
summary <- acti_calculate_measures(
  data,
  calculate_mims = FALSE,
  calculate_ac = FALSE,
  flag_data = FALSE
)
summary
```

## Counts and wear

```{r, eval = FALSE}
counts <- acti_calculate_counts(data)
wear <- acti_calculate_nonwear(counts)
head(counts)
head(wear)
```

## MIMS preprocessing

```{r}
processed <- mims_default_processing(data[1:6000, ], round_after_processing = TRUE)
head(processed)
```

## Calibration

Calibration uses the van Hees method as implemented by `agcounts`, which is
the same approach typically exposed through `GGIR`.

```{r, eval = FALSE}
calibrated <- acti_calibrate(data)
get_transformations(calibrated)
```
