gles_recode_partyvar: gles_recode_partyvar

Description Usage Arguments Value Examples

View source: R/gles.R

Description

Recode a multiparty-variable in GESIS-Datasets such as the GERMAN LONGITUDINAL ELECTION STUDY (GLES)

Usage

1
2
3
4
5
gles_recode_partyvar(year = 2017, dataset_input = "gles2017",
  dataset_output = "gles2017_out", varname = "q52", own = NULL,
  varlabel = "soz", key = c("a", "b", "c", "d", "e", "f", "g"),
  partynames = c("cdu", "csu", "spd", "linke", "gruene", "fdp", "afd"),
  NAs = "<0", plot = TRUE)

Arguments

year

year the GLES-study is from. Defaults to 2017.

dataset_input

Character string of the name of a dataframe containing the raw data.

dataset_output

Character string of the name the output data frame (may already exist or not).

varname

Character string of the name of the original variable.

own

May apply: Different variable name for own position (on left-right scales, e.g.)

varlabel

Character string of the to-be-assigned variable label.

key

Character vector containing original alphabetic party keys.

partynames

Character vector containing shortname party keys.

NAs

Numeric vector containing to-be-assigned NAs/Missing values.

plot

Logical T/F: Show relative frequency barplots while plotting.

Value

A data frame containing output dataframe including newly appended new-variables.

Examples

1
2
3
4
5
6
7
8
gles_recode_partyvar(year = 2017,
                     dataset_input = "gles2017",
                     dataset_output = "gles2017_out",
                     varname = "q52",
                     varlabel = "soz",
                     key = c("a","b","c","d","e","f","g"),
                     partynames = c("cdu","csu","spd","linke","gruene","fdp","afd"),
                     NAs = c(-97,-98,-99))

schliebs/voteR documentation built on May 7, 2019, 3:33 p.m.