The goal of walkboutr
is to process GPS and accelerometry data into walking bouts. walkboutr
will either return the original dataset along with bout labels and categories, or a summarized and de-identified dataset that can be shared for collaboration.
Installation
You can install the development version of walkboutr
from GitHub with:
# install.packages("devtools")
devtools::install_github("rwalkbout/walkboutr")
Basic Usage
Simulated sample data
This is an example of simulated data that could be processed by walkboutr.
The GPS data contain the required columns: time, latitude, longitude, speed. The accelerometry data contain the required columns: time, accerometry counts. These data have no extra columns, do not contain NAs, and don’t contain negative speeds or accelerometry counts. All times are also in date-time format.
library(walkboutr)
# generate sample gps data:
gps_data <- generate_walking_in_seattle_gps_data()
# generate sample accelerometry data:
accelerometry_counts <- make_full_day_bout_without_metadata()
time | latitude | longitude | speed |
---|---|---|---|
2012-04-07 00:00:30 | 47.60620 | 122.3321 | 3.3588907 |
2012-04-07 00:01:00 | 47.62163 | 122.3475 | 2.4004880 |
2012-04-07 00:01:30 | 47.63056 | 122.3565 | 0.6412646 |
2012-04-07 00:02:00 | 47.63372 | 122.3596 | 1.6616599 |
2012-04-07 00:02:30 | 47.63995 | 122.3659 | 2.0068013 |
2012-04-07 00:03:00 | 47.64775 | 122.3737 | 1.1009735 |
activity_counts | time |
---|---|
0 | 2012-04-07 00:00:30 |
0 | 2012-04-07 00:01:00 |
0 | 2012-04-07 00:01:30 |
0 | 2012-04-07 00:02:00 |
500 | 2012-04-07 00:02:30 |
500 | 2012-04-07 00:03:00 |
Now that we have sample data, we can look at how the walkboutr
package works. There are two top level functions that will allow us to generate either (1) a dataset with bouts and bout categories with all of our original data included, or (2) a summary dataset that is completely de-identified and shareable for research purposes.
Walk bout dataset including original data
walk_bouts <- identify_walk_bouts_in_gps_and_accelerometry_data(gps_data,accelerometry_counts)
bout | bout_category | activity_counts | time | non_wearing | complete_day | latitude | longitude | speed |
---|---|---|---|---|---|---|---|---|
1 | walk_bout | 500 | 2012-04-07 00:03:00 | FALSE | TRUE | 47.64775 | 122.3737 | 1.1009735 |
1 | walk_bout | 500 | 2012-04-07 00:05:00 | FALSE | TRUE | 47.69056 | 122.4165 | 2.7901428 |
1 | walk_bout | 500 | 2012-04-07 00:07:00 | FALSE | TRUE | 47.75155 | 122.4775 | 0.9801357 |
1 | walk_bout | 500 | 2012-04-07 00:05:30 | FALSE | TRUE | 47.70371 | 122.4296 | 2.7249735 |
1 | walk_bout | 500 | 2012-04-07 00:06:00 | FALSE | TRUE | 47.71635 | 122.4423 | 4.0867381 |
1 | walk_bout | 500 | 2012-04-07 00:06:30 | FALSE | TRUE | 47.73631 | 122.4622 | 3.0513150 |
Summarized walk bout dataset
This dataset is a set of labelled bouts that are categorized (bout_category
) and contains information on bout specific median speed (median_speed
), the start time of the bout (bout_start
), the duration of the bout (in minutes for computational ease, duration
), and a flag for whether the bout came from a dataset with a complete day worth of data (complete_day
).
summary <- summarize_walk_bouts(walk_bouts)
bout | median_speed | complete_day | bout_start | duration | bout_category |
---|---|---|---|---|---|
1 | 2.736466 | TRUE | 2012-04-07 00:02:30 | 5.0 | walk_bout |
2 | 2.555720 | TRUE | 2012-04-07 00:09:30 | 4304.5 | walk_bout |
In this example, we have 2 bout(s), and each bout has a label. Bout 1 occurred on 2012.04.07 and has a complete day worth of data (complete_day
= TRUE) and a start time of 00:02:30. This bout lasted 5 minutes, or 0.0833333 hours. The bout is a non-walk bout because the participant was moving too slowly for this walk to be considered walking.
For more information on bout categories and how these are assigned, please see the vignette titled Generate Walk Bouts.