plot_timeseries: Plot a timeseries of Hyfe counts.

Description Usage Arguments

View source: R/plot_timeseries.R

Description

Plot a timeseries of Hyfe counts.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
plot_timeseries(
  ho,
  type = c("coughs", "sounds", "sessions"),
  unit = c("days", "hours", "weeks"),
  date_min = NULL,
  date_max = NULL,
  by_user = FALSE,
  running_mean = NULL,
  print_plot = TRUE,
  return_plot = FALSE,
  return_data = FALSE
)

Arguments

ho

A hyfe object, which is generated by process_hyfe_data(). See full details and examples in the package vignette.

type

The variable to plot.

date_min

Optionally filter the data to a minimum date. Provide as a character vector of length one, with the format "YYYY-MM-DD HH:MM:SS".

date_max

Optionally filter to a date maximum. Same format as date_min above.

by_user

If FALSE (the default), a single line will be plotted that pools all users together. If TRUE, a line will be plotted for each user separately. Note that this is only possible if the call to process_hyfe_data() that created the hyfe object used the argument by_user=TRUE.

running_mean

If you wish to add a running mean, provide a binning window here in the units chosen. This will only work if you are not plotting by_yser. If NULL, no running mean will be plotted. For example, when time_unit = hours and running_mean = 24, the running mean will average the y variable for a 24-hour period, stepping forward one hour at a time.

print_plot

If TRUE (the default), the plot will be printed for you.

return_plot

If TRUE (not the default), the ggplot plot object will be returned. This can be useful if you want to modify/add to the plot (e.g., change axis titles, add a plot title, etc.).

return_data

If TRUE (not the default), a simple dataframe will be returned that provides you with the exact values used to produce the plot.

time_unit

The time unit by which to plot it.


hyfe-ai/hyfer documentation built on Dec. 20, 2021, 5:53 p.m.