moderate_more: Moderate the value of "more" or similar

Description Usage Arguments Examples

Description

When numeric answer options have a "more" value, it substitutes more with the largest explicit number, or the largest explicit number multiplied by an increase factor. If the increase factor is less than 1.0 it can be used to moderate the smallest value for "less" or similar statements among numeric answers.

Usage

1
moderate_more(x, moderate = 999, increase = 1, rounding = 0)

Arguments

x

A numeric vector where "more" or other values have to be replaced.

moderate

The threshold to start moderation.

increase

Do you want to increase/decrease the last explicit value? Defaults to 1.0. If max(x)=100 and set to increase = 1.2 than the replacement value will be 120.

rounding

Should the increased/decreased values be rounded? Defaults to rounding to nearest integer value with rouding = 0 digits.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
raw_column <- c("12", "20", "3", "more")
raw_column <- ifelse ( raw_column == "more",
                       yes = "999",
                       no = raw_column )

raw_column <- as.numeric ( raw_column )

moderate_more ( x = raw_column,
                moderate = 999,
                increase = 1.0,
                rounding = 0 )

moderate_more ( x = raw_column,
                moderate = 999,
                increase = 1.26,
                rounding = 1)

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