Skip to contents

clean_data() performs some simple data wrangling to prepare the input data.frame for the more plot specific data transformations.

Usage

clean_data(
  dat,
  all_states,
  states = NULL,
  sub_groups = NULL,
  competence = NULL,
  parameter = "mean"
)

Arguments

dat

Input data.frame stemming from eatRep.

all_states

Character vector of the different groups that should be plotted seperatly. Normally these should be the states (Bundesländer).

states

Character vector of the states that should be plotted.

sub_groups

Character vector of the different sub_groups.

competence

Character string containing the competence that should be plotted.

parameter

Character string of the parameter value that should be reported. Defaults to "mean".

Value

clean_data() returns a data.frame with renamend columns and filled in NAs.

Details

The following operations are performed on dat:

  • For consistency, points in column names are subbed with underscores.

  • Only rows containing mean in dat$parameter are returend.

  • The group wholeGroup currently contains NAs in the columns dat[ , state_var] and dat$grouping_var. These are subbed with wholeGroup or noGroup respectively.

  • The column dat[ , state_var] is filled up by extracting the first state found in dat$groups for the respective row.

Examples

# tbd