fitbitr - Explore your Fitbit data in R

R-CMD-check CRAN Version Lifecycle: experimental Codecov test coverage

fitbitr makes it easy to interface with Fitbit data in R.

Installation

You can install the CRAN version of fitbitr with:

install.packages("fitbitr")

Or you can install the latest development version from Github:

# install.packages("devtools")
devtools::install_github("mrkaye97/fitbitr")

Setup

There are a few steps you’ll need to do before you can start pulling your Fitbit data:

  1. Make an app here.

  2. Fill in the fields as you like (see image below for guidance).

  3. You’ll be redirected to a page with your credentials. Make sure you keep the Client ID, Client Secret, and Redirect URL. You’ll need them to finish the setup process. You can always refer back to the apps page to find them again.

  4. Generate a token:

    library(fitbitr)
    
    generate_token(
      client_id = <YOUR-CLIENT-ID>,
      client_secret = <YOUR-CLIENT-SECRET>
      callback = <YOUR-REDIRECT-URL>
    )
  5. And that’s it! You now have your Fitbit API credentials set up. fitbitr tracks them behind the scenes for you, so all that you need to do at the start of each R session is either generate_token() or load_cached_token(), and you’ll be off and running.