submissions_timeseries_lineplot: Generating a line plot that shows the number of submissions...

Description Usage Arguments Value Examples

View source: R/submissions_timeseries_lineplot.R

Description

The function shows a line plot with the number of submissions per day. It does account for days where no submissions were recorded by adding the missing days wit a value of 0 so that also days were no data was collected are represented in the plot. Optionally, a vertical line can be added that represents the daily number of submissions goal. Further, weekends can be excluded since often there is no data collection happening and would therefore make the plot less concise and comprehensive. Below the plot, there is a range slider which can be used to define the range of time that the plot shows. Depending on the overall time span of the data, there are several buttons (1w = 1 week, 1m = 1 month, 6m = ..., 1y = ..., or all) that can be used to pre-define a time window that is applied to the range slider. In order to determine the collection period the function collection_period is used. Please note, that one and only one of the three data arguments (df, csv, svc) must be specified.

Usage

1
2
3
4
5
6
7
8
9
submissions_timeseries_lineplot(
  df = NULL,
  csv = NULL,
  svc = FALSE,
  date_col,
  daily_submission_goal = 0,
  exclude_wday = NULL,
  cumulative = TRUE
)

Arguments

df

Data frame containing the ODK data that is to be used. Optional, defaults to NULL.

csv

Character that specifies the path to the csv file that is to be read. Optional, defaults to NULL.

svc

Logical that indicates whether the data shall be parsed using ruODK's odata_submission_get. Optional, defaults to FALSE.

date_col

String that specifies the date or time stamp column in the data which is to be examined.

daily_submission_goal

Integer or float that defines the number of daily submissions goal.

exclude_wday

Integer (for one day) or integer vector (for multiple days) containing the day(s) of the week that shall not be included when generating the plot, defaults to NULL. Specify the days as following: 1 = Sun, 2 = Mon, ..., 7 = Sun.

cumulative

Logical that determines whether the cumulative sum of submissions is used as values for y. Optional, defaults to TRUE.

Value

Plotly html-widget

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
# 1. with SVC
# ruODK needs to be set up for this function to work
repvisforODK::setup_ruODK(svc = 'example/svc.svc', un = 'exampleusername', pw = 'examplepassword', tz = 'Europe/Berlin', verbose = TRUE)

submissions_timeseries_lineplot(svc = TRUE, daily_submission_goal = 4, date_col = 'start', exclude_wday = c(1, 7), cumulative = TRUE)

# 2. with data frame
submissions_timeseries_lineplot(df = df_odk_data, daily_submission_goal = 4, date_col = 'start', exclude_wday = c(1, 7), cumulative = TRUE)

# 3. with csv
submissions_timeseries_lineplot(csv = 'example/file/odk_data.csv', daily_submission_goal = 4, date_col = 'start', exclude_wday = c(1, 7), cumulative = TRUE)

## End(Not run)

SwissTPH/repvisforODK documentation built on Feb. 13, 2022, 9:14 a.m.