Introduction to lifelogr’s visualization functions

library(lifelogr)

There are 3 functions which allow for a series of plots with just one function call: plot_sleep_all, plot_daily_all, and plot_intraday_all. Each acts like the plot.lm function, where users must click “enter” to see the next plot.

Each plot within the generic plot function can also be called individually.

Sleep Plots

Here are the sleep plots for EX:

plot_sleep_all(EX)

#> Press [enter] to continue
#> Coordinate system already present. Adding new coordinate system, which will
#> replace the existing one.

#> Press [enter] to continue
#> Warning: Use of `data$value` is discouraged.
#> ℹ Use `value` instead.
#> Use of `data$value` is discouraged.
#> ℹ Use `value` instead.

#> Press [enter] to continue
#> Warning: Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.
#> Warning: Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.

#> Press [enter] to continue
#> Warning: Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.
#> Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.

#> Press [enter] to continue
#> Warning: Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.
#> Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.

#> Press [enter] to continue

Users can also call each function individually using plot_sleep(person, plot_type). For example:

plot_sleep(EX, "by_datetime")
#> Warning: Use of `data$value` is discouraged.
#> ℹ Use `value` instead.
#> Use of `data$value` is discouraged.
#> ℹ Use `value` instead.

Some plots have other options.

For example, plot_sleep_start_end has a color_var = "day_of_week" argument to color the lines by day of the week instead of weekend/weekday.

plot_sleep_start_end(EX, "day_of_week")
#> Coordinate system already present. Adding new coordinate system, which will
#> replace the existing one.

Daily Total Plots

Here are the plots for the daily totals for EX:

plot_daily_all(EX)
#> Warning: Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.
#> Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.

#> Press [enter] to continue
#> Warning: Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.
#> Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.

#> Press [enter] to continue
#> Warning: Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.
#> Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.

#> Press [enter] to continue
#> Warning: Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.
#> Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.

#> Press [enter] to continue
#> Warning: Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.
#> Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.

#> Press [enter] to continue
#> Warning: Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.
#> Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.

#> Press [enter] to continue

Users can also call each function individually using:

plot_daily(EX, "steps")
#> Warning: Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.
#> Use of `data[[measures]]` is discouraged.
#> ℹ Use `.data[[measures]]` instead.

Within Each day Plots

Here are the plots for intraday data (multiple data points collected within each day). The default is to aggregate the data by time intervals within each day so that data for a “typical day” is displayed.

plot_intraday_all(EX)
#> Warning: Use of `data$time` is discouraged.
#> ℹ Use `time` instead.
#> Warning: Use of `data$avg` is discouraged.
#> ℹ Use `avg` instead.

#> Press [enter] to continue
#> Warning: Use of `data$time` is discouraged.
#> ℹ Use `time` instead.
#> Use of `data$avg` is discouraged.
#> ℹ Use `avg` instead.

#> Press [enter] to continue
#> Warning: Use of `data$time` is discouraged.
#> ℹ Use `time` instead.
#> Use of `data$avg` is discouraged.
#> ℹ Use `avg` instead.

#> Press [enter] to continue
#> Warning: Use of `data$time` is discouraged.
#> ℹ Use `time` instead.
#> Use of `data$avg` is discouraged.
#> ℹ Use `avg` instead.

#> Press [enter] to continue
#> Warning: Use of `data$time` is discouraged.
#> ℹ Use `time` instead.
#> Use of `data$avg` is discouraged.
#> ℹ Use `avg` instead.

#> Press [enter] to continue
#> Warning: Use of `data$time` is discouraged.
#> ℹ Use `time` instead.
#> Use of `data$avg` is discouraged.
#> ℹ Use `avg` instead.

#> Press [enter] to continue
#> Warning: Use of `data$time` is discouraged.
#> ℹ Use `time` instead.
#> Use of `data$avg` is discouraged.
#> ℹ Use `avg` instead.

#> Press [enter] to continue

However, it is also possible to specify that the plots use the raw data and plot over all date-times.

plot_intraday_all(EX, FALSE)
#> Warning: Use of `data$datetime` is discouraged.
#> ℹ Use `datetime` instead.
#> Warning: Use of `data[[measure_var]]` is discouraged.
#> ℹ Use `.data[[measure_var]]` instead.

#> Press [enter] to continue
#> Warning: Use of `data$datetime` is discouraged.
#> ℹ Use `datetime` instead.
#> Use of `data[[measure_var]]` is discouraged.
#> ℹ Use `.data[[measure_var]]` instead.

#> Press [enter] to continue
#> Warning: Use of `data$datetime` is discouraged.
#> ℹ Use `datetime` instead.
#> Use of `data[[measure_var]]` is discouraged.
#> ℹ Use `.data[[measure_var]]` instead.

#> Press [enter] to continue
#> Warning: Use of `data$datetime` is discouraged.
#> ℹ Use `datetime` instead.
#> Use of `data[[measure_var]]` is discouraged.
#> ℹ Use `.data[[measure_var]]` instead.

#> Press [enter] to continue
#> Warning: Use of `data$datetime` is discouraged.
#> ℹ Use `datetime` instead.
#> Use of `data[[measure_var]]` is discouraged.
#> ℹ Use `.data[[measure_var]]` instead.

#> Press [enter] to continue
#> Warning: Use of `data$datetime` is discouraged.
#> ℹ Use `datetime` instead.
#> Use of `data[[measure_var]]` is discouraged.
#> ℹ Use `.data[[measure_var]]` instead.

#> Press [enter] to continue
#> Warning: Use of `data$datetime` is discouraged.
#> ℹ Use `datetime` instead.
#> Use of `data[[measure_var]]` is discouraged.
#> ℹ Use `.data[[measure_var]]` instead.

#> Press [enter] to continue