Description Usage Format Methods Examples
DataLoader is an R6 Class that connects to the Fitbit API with the credentials, requests the data, and writes the response to JSON files,
1 |
A R6Class
generator object
connect(appname, key, secret, cache.file)
This method connects to the Fitbit API and to your application.
appname
: Name of the Fitbit App
key
: Fitbit API Client key
secret
: Fibit API Client secret
cache.file
: Path to a cached token file, instead of providing credentials in the function call
request(type = "day", activities = "", start.date = Sys.Date(), end.date = "", path = "./json/"))
This method builds the request URLs, sends the requests and writes response to JSON files, in the specified folder.
type
: Type of time series. Must be 'day' or 'intraday'.
activities
: A list of the Fitibit activities to be retrieved.
start.date
: Start date in format YYYY-mm-dd.
end.date
: End date in format YYYY-mm-dd.
path
: Folder where the JSON files will be written.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
testObject <- DataLoader$new()
testObject$connect(appname = "abcd",
key = "123ABC",
secret = "3089e3h1ac9dde0aa67b54ajc8691j44")
testObject$request(
type = 'day',
activities = list("calories", "steps", "distance", "minutesVeryActive"),
start.date = "2016-01-01",
end.date = "2016-02-01",
path = "~/fitbit-daily/")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.