Learn R Programming

eventreport (version 0.1.1)

aggregateData: Aggregate event report data

Description

This function aggregates event report data based on a specified grouping variable and various aggregation criteria.

Usage

aggregateData(
  data,
  group_var = "event_id",
  find_mode = NULL,
  find_mode_na_ignore = NULL,
  find_mode_bin = NULL,
  find_mode_date = NULL,
  find_mode_numeric = NULL,
  find_least_precise = NULL,
  find_most_precise = NULL,
  combine_strings = NULL,
  find_max = NULL,
  find_min = NULL,
  summarize_vars = NULL,
  aggregation_name = NULL,
  tie_break = "default_tie_break",
  second_tie_break = "default_tie_break"
)

Value

A data frame with the aggregated results.

Arguments

data

A data frame containing the data to be aggregated.

group_var

A string specifying the variable to group by. Default is "event_id".

find_mode

A vector of variable names for which to find the mode.

find_mode_na_ignore

A vector of variable names for which to find the mode, ignoring NAs.

find_mode_bin

A vector of variable names for which to find the binary mode.

find_mode_date

A vector of variable names for which to find the mode for dates.

find_mode_numeric

A vector of variable names for which to find the mode for numeric values.

find_least_precise

A list of lists, each containing a variable name and its corresponding precision variable, to find the least precise value.

find_most_precise

A list of lists, each containing a variable name and its corresponding precision variable, to find the most precise value.

combine_strings

A vector of variable names for which to combine strings.

find_max

A vector of variable names for which to find the maximum value.

find_min

A vector of variable names for which to find the minimum value.

summarize_vars

A vector of variable names for which to sum all values.

aggregation_name

A string specifying the name of the aggregation.

tie_break

A string specifying the tie break column name. Default is "default_tie_break".

second_tie_break

A string specifying the second tie break column name. Default is "default_tie_break".

Examples

Run this code
small_maverick_event_report %>%
  aggregateData(group_var = "event_id", find_mode = "city") %>%
  utils::head(10)

Run the code above in your browser using DataLab