# Simple function to generate REDCap choices from character vector — char2choice • REDCapCAST
Simple function to generate REDCap choices from character vector

Skip to contents

# Simple function to generate REDCap choices from character vector

Source: `R/doc2dd.R`
`char2choice.Rd`

Simple function to generate REDCap choices from character vector

## Usage

    char2choice(data, char.split = "/", raw = NULL, .default = NA)

## Arguments

data

  vector

char.split

  splitting character(s)

raw

  specific values. Can be used for options of same length.

.default

  default value for missing. Default is NA.

## Value

vector

## Examples

    char2choice(c("yes/no","  yep. / nope  ","",NA,"what"),.default=NA)
    #> [1] "1, yes | 2, no"    "1, yep. | 2, nope" NA
    #> [4] NA                  "1, what"