Learn R Programming

Rrepest (version 1.6.12)

average_groups: Group Averages

Description

Group Averages

Usage

average_groups(
  res,
  data = NULL,
  group,
  by = NULL,
  over = NULL,
  est = NULL,
  svy = NULL,
  user_na = FALSE,
  ...
)

Value

Dataframe with averages or weighted averages (totals) appended in the last rows for the selected cases.

Arguments

res

(dataframe) Data frame of results, including estimates and standard errors to be averaged.

data

(dataframe) Data frame containing replicated weights.

group

(grp function) Function used to compute grouped averages; takes arguments group.name, column, and cases, and appends results at the end of the data frame.

by

(string vector) Variable(s) used to break down the results.

over

(vector string) Variable(s) over which the analysis is performed.

est

(est function) Estimation function; takes arguments what = estimate, tgt = target, and rgr = regressor.

svy

(string) Name of the survey/project to analyse (e.g. TALISSCH, TALISTCH).

user_na

(bool) If TRUE, shows the nature of user-defined missing values for the grouping variable(s).

...

Additional arguments such as na_to_zero: (Bool) TRUE → treats NA values as zero for simple average calculations.