Fill in and rename necessary columns
clean_data.Rd
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"
.
Details
The following operations are performed on dat
:
For consistency, points in column names are subbed with underscores.
Only rows containing
mean
indat$parameter
are returend.The group
wholeGroup
currently containsNAs
in the columnsdat[ , state_var]
anddat$grouping_var
. These are subbed withwholeGroup
ornoGroup
respectively.The column
dat[ , state_var]
is filled up by extracting the first state found indat$groups
for the respective row.