coverage {mpathsenser}R Documentation

Create a coverage chart of the sampling rate

Description

[Stable]

Only applicable to non-reactive sensors with 'continuous' sampling

Usage

coverage(
  db,
  participant_id,
  sensor = NULL,
  frequency = mpathsenser::freq,
  relative = TRUE,
  offset = "None",
  start_date = NULL,
  end_date = NULL,
  plot = deprecated()
)

Arguments

db

A valid database connection. Schema must be that as it is created by open_db.

participant_id

A character string of one participant ID.

sensor

A character vector containing one or multiple sensors. See sensors for a list of available sensors. Use NULL for all available sensors.

frequency

A named numeric vector with sensors as names and the number of expected samples per hour

relative

Show absolute number of measurements or relative to the expected number? Logical value.

offset

Currently not used.

start_date

A date (or convertible to a date using base::as.Date()) indicating the earliest date to show. Leave empty for all data. Must be used with end_date.

end_date

A date (or convertible to a date using base::as.Date()) indicating the latest date to show.Leave empty for all data. Must be used with start_date.

plot

[Deprecated] Instead of built-in functionality, use plot.coverage() to plot the output.

Value

A ggplot of the coverage results if plot is TRUE or a tibble containing the hour, type of measure (i.e. sensor), and (relative) coverage.

Examples

## Not run: 
freq <- c(
  Accelerometer = 720, # Once per 5 seconds. Can have multiple measurements.
  AirQuality = 1,
  AppUsage = 2, # Once every 30 minutes
  Bluetooth = 60, # Once per minute. Can have multiple measurements.
  Gyroscope = 720, # Once per 5 seconds. Can have multiple measurements.
  Light = 360, # Once per 10 seconds
  Location = 60, # Once per 60 seconds
  Memory = 60, # Once per minute
  Noise = 120,
  Pedometer = 1,
  Weather = 1,
  Wifi = 60 # once per minute
)

coverage(
  db = db,
  participant_id = "12345",
  sensor = c("Accelerometer", "Gyroscope"),
  frequency = mpathsenser::freq,
  start_date = "2021-01-01",
  end_date = "2021-05-01"
)

## End(Not run)

[Package mpathsenser version 1.2.3 Index]