chr_logical: Character to logical conversion

Description Usage Arguments Examples

Description

Converts logical answers from text documents.

Usage

1
2
chr_logical(column, false_id = "default", true_id = "default",
  na_labels = "default", na_value = NA)

Arguments

column

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

false_id

The false values in the original raw data. defaults to "0". "default" searches for statements starting with c("nincs", "none", "ne", "no", "non", "never").

true_id

The true values in the original raw data, defaults to "1". "default" searches for statements starting with c("van", "igen", "yes", "da", "oui").

na_labels

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

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.

Examples

1
2
3
4
5
chr_logical(column = as.character (c("1 - yes", "1", "0 - no",
           "missing", NA)),
           false_id  = "0 - no",
           true_id = "1 - yes",
           na_labels = "missing" )

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