scale_factor: Scale factor

Description Usage Arguments Examples

Description

Converts factors that are scaled, only in the case where the scaling is coded with starting numbers such as "3 - city", "2 - town", "1 - village".

Usage

1
2
scale_factor(column, digits = 1, na_id = NA, na_value = NA,
  is_integer = FALSE)

Arguments

column

A column from a survey data frame where gender is recorded.

digits

How many digits are valid in the scaling.

na_id

Is there a special character ID for missing variables? (Default: "NA" )

na_value

What should be the value of missing answers (Default: "NA", but in some cases it is useful to code them 0. ) If you get a warning with NA conversion, you are likely to have several NA characters, such as missing and NA at the same time.

is_integer

Numeric or integer should be returned? Defaults to FALSE in which case no validation takes place.

Examples

1
2
3
4
5
scale_factor (column = as.character (c("3 - city",
            "2 - town", NA, "NA", "1 - village")),
            digits = 1,
            na_id = "NA",
            is_integer = FALSE )

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