The walkboutr
package has several functions to generate
sample data so that you can see how the package works in practice. We
generate GPS data and accelerometry data separately, as that is how you
will provide your data to walkboutr
.
GPS Data Generation
GPS data provided should contain the following columns and have the relevant characteristics:
- time values should be in date-time format and be all non-missing
- latitude values should be between -90 and 90 and be all non-missing
- longitude values should be between -180 and 180 and be all non-missing
- speed values should all be positive, non-missing values in km/h
These data will be processed and later combined with accelerometry data to generate walkbouts. #### Generating sample GPS data
gps_data <- generate_gps_data(start_lat = 40.7128, start_long = 74.0060, start_time = lubridate::ymd_hms('2012-04-07 00:00:30'))
These sample GPS data meet all of the characteristics outlined above:
time | latitude | longitude | speed |
---|---|---|---|
2012-04-07 00:00:30 | 40.71280 | 74.00600 | 4.5542117 |
2012-04-07 00:01:00 | 40.73372 | 74.02692 | 2.4004880 |
2012-04-07 00:01:30 | 40.74265 | 74.03585 | 0.6412646 |
2012-04-07 00:02:00 | 40.74581 | 74.03901 | 1.6616599 |
2012-04-07 00:02:30 | 40.75204 | 74.04524 | 2.0068013 |
2012-04-07 00:03:00 | 40.75984 | 74.05305 | 1.1009735 |
walkboutr
also has a function to generate a realistic
walking route in Seattle, which is simply meant to provide another
example for generating data and becoming familiar with the package:
seattle <- generate_walking_in_seattle_gps_data()
These data look exactly the same as the randomly generated sample GPS data:
time | latitude | longitude | speed |
---|---|---|---|
2012-04-07 00:00:30 | 47.60620 | 122.3321 | 3.8025233 |
2012-04-07 00:01:00 | 47.62367 | 122.3496 | 2.4004880 |
2012-04-07 00:01:30 | 47.63260 | 122.3585 | 0.6412646 |
2012-04-07 00:02:00 | 47.63576 | 122.3617 | 1.6616599 |
2012-04-07 00:02:30 | 47.64199 | 122.3679 | 2.0068013 |
2012-04-07 00:03:00 | 47.64979 | 122.3757 | 1.1009735 |
Generating sample Accelerometry data
Accelerometry data provided should contain the following columns and have the relevant characteristics:
- time values should be in date-time format and be all non-missing
- activity_count values should be the output of accelerometers and represent activity counts in CPE. These values should be non-missing and non-negative.
These data will be processed and later combined with the GPS data to generate walkbouts.
There are more functions to generate accelerometry data so that you can see the differences based on the size of the dataset. The following functions are included for you to generate sample data:
For the purposes of this example, we will create generate the smallest walk bout.
accelerometry_counts <- make_smallest_bout_without_metadata()
These sample accelerometry data meet all of the characteristics outlined above:
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 |
Generating a full data frame of walk bouts
This function generates a data frame of walk bouts with accelerometry and GPS data so that you can get an idea of how some of the top level functions work. These data won’t be used directly by the package, but are here to give you an idea of what a full dataset looks like as it goes into the final steps of the package.
In order to generate these data, you can use the
make_full_walk_bout_df
function:
walk_bouts <- make_full_walk_bout_df()
This dataset looks like this:
time | latitude | longitude | speed | activity_counts | bout | inactive | non_wearing | n_epochs_date | complete_day |
---|---|---|---|---|---|---|---|---|---|
2012-04-07 00:00:30 | 47.60620 | 122.3321 | 3.8025233 | 0 | NA | TRUE | FALSE | 8616 | TRUE |
2012-04-07 00:01:00 | 47.62367 | 122.3496 | 2.4004880 | 0 | NA | TRUE | FALSE | 8616 | TRUE |
2012-04-07 00:01:30 | 47.63260 | 122.3585 | 0.6412646 | 0 | NA | TRUE | FALSE | 8616 | TRUE |
2012-04-07 00:02:00 | 47.63576 | 122.3617 | 1.6616599 | 0 | NA | TRUE | FALSE | 8616 | TRUE |
2012-04-07 00:02:30 | 47.64199 | 122.3679 | 2.0068013 | 500 | 1 | FALSE | FALSE | 8616 | TRUE |
2012-04-07 00:03:00 | 47.64979 | 122.3757 | 1.1009735 | 500 | 1 | FALSE | FALSE | 8616 | TRUE |
generate_gps_data()
generate_walking_in_seattle_gps_data()
make_smallest_bout_window()
make_smallest_nonwearing_window()
make_smallest_complete_day_activity()
make_smallest_bout()
make_smallest_bout_without_metadata()
make_smallest_bout_with_largest_inactive_period()
make_smallest_bout_with_smallest_non_wearing_period()
make_full_day_bout()
make_full_day_bout_without_metadata()
make_full_walk_bout_df()