if (FALSE) {
require(fitbitViz)
#.........................................
# first compute the sleep time time series
#.........................................
USER_ID = '99xxxx'
token = 'my_long_web_api_token'
sleep_ts = sleep_time_series(user_id = USER_ID,
token = token,
date_start = '2021-03-09',
date_end = '2021-03-16',
ggplot_color_palette = 'ggsci::blue_material',
show_nchar_case_error = 135,
verbose = TRUE)
sleep_ts$plt_lev_segments
sleep_ts$plt_lev_heatmap
sleep_ts$heatmap_data
#...........................................
# (option to) save the ggplot to a .png file
#...........................................
png_file = tempfile(fileext = '.png')
ggplot2::ggsave(filename = png_file,
plot = sleep_ts$plt_lev_segments,
device = 'png',
scale = 1,
width = 35,
height = 25,
limitsize = TRUE)
}
Run the code above in your browser using DataLab