Learn R Programming

telraamStats (version 1.1.2)

filter_agg: Filter by selected criteria and aggregating traffics.

Description

Not all criteria need to be filled in. Unfilled criteria are set by default so that no filtering is performed.

Usage

filter_agg(
  data,
  date_range = NULL,
  segments = NULL,
  direction = NULL,
  modes = NULL,
  weekdays = NULL,
  hours = NULL,
  uptime_quality = TRUE
)

Value

the filtered data, molten by mode and direction, with new columns :

  • mode, the mode, one row per different transportation mode + date/hour + direction

  • direction, the direction, one row per different transportation mode + date/hour + direction

  • traffic_sum, the traffic for this mode/direction on this specific date/hour

Arguments

data

Traffic Data Frame

date_range

Date vector, c("aaaa-mm-jj","aaaa-mm-jj")

segments

Vector of character. Ids of desired segments.

direction

Vector of character. Direction of the street (lft, right, both).

modes

Vector of character. Type(s) of mobility: c("car","heavy","pedestrian","bike")

weekdays

Vector of character. Weekday(s) choosen.

hours

Integer vector. Hours choosen, default to the all day.

Examples

Run this code
date_range = as.Date(c('2022-01-01','2022-01-08'))
filter_agg(traffic,
  date_range = date_range,
  segments = 'RteVitre-06',
  direction = 'lft',
  modes = 'pedestrian',
  weekdays = 'saturday',
  hours = 12:14,
  uptime_quality = TRUE
  )

Run the code above in your browser using DataLab