Description Usage Arguments Details Value Feature description Examples
This function queries the Fitbit API and returns the activity data for different features in a tidy format.
1 2 | get_activity(from_date, to_date = from_date, features = activity_features(),
detail_level = "1min", token)
|
from_date |
From which date to query the data. Character scalar in the format "YYYY-MM-DD". |
to_date |
Up to which date to query the data. Data for that day are included in the return value. Character scalar in the format "YYYY-MM-DD". |
features |
A character vector listing which features should be queried
and included in the final data.table. Use |
detail_level |
A character scalar specifying how frequently should the returned data be sampled.
Possible options are: '15min', '1min' and '1sec'.
Use |
token |
Fitbit API token generated with |
This is the main function of the fitbitr package. I queries the Fitbit API multiple times
using the fitbit_GET function. It then parses the API outputs and combines them
into a single data.table.
data.table with columns corresponding to different features as described in https://dev.fitbit.com/docs/activity/ and https://dev.fitbit.com/docs/heart-rate/. Each feature also contains the daily summary denoted with a daily_ prefix.
calories_levelLevel field that reflects calculated activity level for that time period ( 0 - sedentary; 1 - lightly active; 2 - fairly active; 3 - very active.)
calories_metsProbably the MET score https://help.fitbit.com/articles/en_US/Help_article/What-are-very-active-minutes.
caloriesCalories burned in this time interval.
daily_caloriesTotal amount of calories burned at that day.
stepsNumber of steps in this time interval.
daily_stepsTotal number of steps at that day.
distanceDistance made in this time interval.
daily_distanceTotal distance made at that day.
floorsNumber of floors made in this time interval.
daily_floorsNumber of floors made in this time interval.
elevationElevation units made in this time interval.
daily_elevationTotal number of elevation units made at that day.
heartMean heart rate in this time interval [beats per second].
daily_elevationDaily mean heart rate [beats per second].
Currently used units are 'Metric' (described in https://dev.fitbit.com/docs/basics/#unit-systems).
Time and date are stored as character vectors.
1 2 3 4 5 6 7 8 9 10 | ## Not run:
fitbit_token <- get_fitbit_token()
dt <- get_activity(from_date = "2015-12-15", to_date = "2015-12-18", token = fitbit_token)
## Heart rate at 1 second precision for the day 2015-12-15
dt <- get_activity(from_date = "2015-12-15", features = "heart",
detail_level = "1sec",
token = fitbit_token)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.