-
Notifications
You must be signed in to change notification settings - Fork 0
Adding in Vignettes #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| *.html | ||
| *.R |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,114 @@ | ||||||
| --- | ||||||
| title: "calculate_cadence" | ||||||
| output: rmarkdown::html_vignette | ||||||
| vignette: > | ||||||
| %\VignetteIndexEntry{calculate_cadence} | ||||||
| %\VignetteEngine{knitr::rmarkdown} | ||||||
| %\VignetteEncoding{UTF-8} | ||||||
| --- | ||||||
|
|
||||||
| ```{r, include = FALSE} | ||||||
| knitr::opts_chunk$set( | ||||||
| collapse = TRUE, | ||||||
| comment = "#>" | ||||||
| ) | ||||||
| ``` | ||||||
|
|
||||||
| ```{r setup} | ||||||
| library(cadence) | ||||||
| ``` | ||||||
|
|
||||||
|
|
||||||
| # Data | ||||||
|
|
||||||
| For this example, we will use the `simulated_nhanes_steps` dataset included in the package. | ||||||
| ```{r} | ||||||
| head(simulated_nhanes_steps) | ||||||
| ``` | ||||||
| ## Data Description | ||||||
| The `simulated_nhanes_steps` dataset contains simulated step count data for individuals, structured similarly to the NHANES accelerometer data. | ||||||
|
|
||||||
| For most computations, we will group by the ID (`SEQN`) and the day of measurement (`PAXDAYM`) using the `nhanes_group_cols()` function. | ||||||
|
|
||||||
| ```{r} | ||||||
| nhanes_group_cols() | ||||||
| ``` | ||||||
|
|
||||||
| # Summarizing Cadence | ||||||
|
|
||||||
| The overall function for summarizing cadence metrics is `summarize_cadence()`. This function computes various cadence metrics, including mean cadence, peak cadence, and time spent in different cadence levels. In this code, we will create these summaries by grouping by `SEQN` and `PAXDAYM`. | ||||||
|
|
||||||
| ```{r} | ||||||
| result <- summarize_cadence(simulated_nhanes_steps, group_cols = nhanes_group_cols()) | ||||||
| head(result) | ||||||
| colnames(result) | ||||||
| ``` | ||||||
| The columns computed are: | ||||||
| - `mean_uncensored_cadence`: Mean cadence without censoring based on counts. | ||||||
| - `mean_censored_cadence`: Mean cadence with censoring based on counts. | ||||||
| - `peak_1min`: Peak 1-minute cadence. | ||||||
| - `peak_30min`: Peak 30-minute cadence. | ||||||
| - `peak_60min`: Peak 30-minute cadence. | ||||||
| - `n_minutes`: Number of total minutes. | ||||||
| - `n_minutes_wear`: Number of minutes with wear time. | ||||||
| - `max_5min` : Maximum 5-minute cadence. | ||||||
| - `max_10min`: Maximum 10-minute cadence. | ||||||
|
||||||
| - `max_10min`: Maximum 10-minute cadence. |
Copilot
AI
Jan 19, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The range description for all_out is slightly inaccurate. According to the source code, the cadence band uses breaks with (119, Inf], meaning values strictly greater than 119. For integer step counts, this would be 120+ steps/min, not 119+ as documented. Consider updating to "120+ steps/min" or ">119 steps/min" for accuracy.
| - `all_out`: Time spent in all-out cadence band: 119+ steps/min. | |
| - `all_out`: Time spent in all-out cadence band: 120+ steps/min. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description for
peak_60minincorrectly states "Peak 30-minute cadence" but should state "Peak 60-minute cadence".