walkboutr
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.
You can install the development version of walkboutr
from GitHub with:
# install.packages("devtools")
::install_github("rwalkbout/walkboutr") devtools
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:
<- generate_walking_in_seattle_gps_data()
gps_data # generate sample accelerometry data:
<- make_full_day_bout_without_metadata() accelerometry_counts
time | latitude | longitude | speed |
---|---|---|---|
2012-04-07 00:00:30 | 47.60620 | 122.3321 | 1.5510573 |
2012-04-07 00:01:00 | 47.61333 | 122.3392 | 2.4004880 |
2012-04-07 00:01:30 | 47.62225 | 122.3482 | 0.6412646 |
2012-04-07 00:02:00 | 47.62541 | 122.3513 | 1.6616599 |
2012-04-07 00:02:30 | 47.63164 | 122.3575 | 2.0068013 |
2012-04-07 00:03:00 | 47.63945 | 122.3654 | 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.
<- identify_walk_bouts_in_gps_and_accelerometry_data(gps_data,accelerometry_counts) walk_bouts
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.63945 | 122.3654 | 1.1009735 |
1 | walk_bout | 500 | 2012-04-07 00:05:00 | FALSE | TRUE | 47.68225 | 122.4082 | 2.7901428 |
1 | walk_bout | 500 | 2012-04-07 00:07:00 | FALSE | TRUE | 47.74325 | 122.4692 | 0.9801357 |
1 | walk_bout | 500 | 2012-04-07 00:05:30 | FALSE | TRUE | 47.69541 | 122.4213 | 2.7249735 |
1 | walk_bout | 500 | 2012-04-07 00:06:00 | FALSE | TRUE | 47.70804 | 122.4340 | 4.0867381 |
1 | walk_bout | 500 | 2012-04-07 00:06:30 | FALSE | TRUE | 47.72800 | 122.4539 | 3.0513150 |
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
).
<- summarize_walk_bouts(walk_bouts) summary
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.