rescale_political_interest: Rescale level of political interest

Description Usage Arguments Examples

Description

Create a uniform variable from four categories such as "Not at all interested in politics", "Slightly interested in politics", "Moderately interested in politics", "Strongly interested in politics". This is a wrapper function around the rescale_categories function.

Usage

1
2
3
4
5
rescale_political_interest(column,
  from = c("Not at all interested in politics",
  "Slightly interested in politics", "Moderately interested in politics",
  "Strongly interested in politics"), to = NULL, na_labels = c("DK"),
  exact_from = TRUE, return_class = "factor", underscore = TRUE)

Arguments

column

A column from a survey data with a four-level scale.

from

Defaults to c("Not at all interested in politics", "Slightly interested in politics", "Moderately interested in politics", "Strongly interested in politics").

to

Defaults to NULL which gives a shorthened version of the labels if the return_class is "character" or "factor" and returns c(0,1,2,3) if it is "numeric".

na_labels

Defaults to c("DK").

exact_from

Deafults to TRUE. If FALSE you can use the partial matching, but beware that in this case, "twenty" will be replaced by

return_class

Default is "factor", alternatives "character" or "numeric".

underscore

Defaults to TRUE in which case factor names or character strings contain underscore_between_words. This is a better approach for further programming, but you can choose FALSE for nicer printing results. See examples.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
rescale_political_interest (c("Not at all interested in politics",
                             "Slightly interested in politics",
                             "DK",
                             "Moderately interested in politics",
                             "Strongly interested in politics"),
                           return_class = "numeric")

rescale_political_interest (c("Not at all interested in politics",
                             "Slightly interested in politics",
                             "DK",
                             "Moderately interested in politics",
                             "Strongly interested in politics"),
                             underscore = FALSE)

antaldaniel/surveyreader documentation built on May 16, 2019, 2:29 a.m.