Skip to content

Instantly share code, notes, and snippets.

@carlislerainey
Created February 22, 2017 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlislerainey/0111324011a7a86d8b2584c16694c826 to your computer and use it in GitHub Desktop.
Save carlislerainey/0111324011a7a86d8b2584c16694c826 to your computer and use it in GitHub Desktop.
Code to load my run logs from Google Sheets
# data loading and tidying
##########################
# Note: we haven't talked about how to do this, and I don't expect you to
# understand the code below.
library(dplyr) # useful function for cleaning up data
library(lubridate) # useful for working with dates and durations
library(magrittr) # useful for data manipulation
library(googlesheets) # used to load the google sheet data
sheet <- gs_key("19aZA5_xnMiNfrpJpVur1FxNWGxUe3l-LlJ8vPp7_uBc") # register google sheet
runs <- gs_read(sheet) # load sheet
runs <- runs %>%
mutate(date = mdy(date),
minutes = as.numeric(time)/60) %>%
rename(average_heart_rate = av_hr) %>%
select(-time)
# done with tidying
###################
# quick look at data
tibble::glimpse(runs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment