Learn R Programming

eye (version 1.0.0)

recodeye: Recode eyes

Description

recoding eyes to "r" and "l"

Usage

recodeye(x, to = NULL, eyecodes = NULL, dropunknown = TRUE)

Value

Character vector

string detection

recodeye will automatically detect the following strings: right = c("r", "re", "od", "right"), left = c("l", "le", "os", "left"), both = c("b","both","ou")

to and eyecode arguments

If passed, should ideally be of same length, and have the respective eyes at the same index (or with the same name!). If the lengths are not equal, e.g., if only "to" is passed with n elements, the shorter argument will be will be cut down to the first n elements of the longer argument.

Note that all unique strings which are part of the column should be contained in the "eyecode" argument.

numeric coding

Currently numeric coding only accepts binary coding (right and left eye). In order to use numeric coding for "both eyes" as well, a workaround using the eyecodes argument is suggested.

See Also

Other string matching functions: getElem, set_codes(), sort_substr(), str_func_facs

Examples

Run this code
# NOT RUN {
x <- c("r", "re", "od", "right", "l", "le", "os", "left")
recodeye(x)

## or with "both eyes"
x <- c(x, "both", "ou")
recodeye(x)

## chose the resulting codes
recodeye(x, to = c("od", "os", "ou"))

x <- 1:2
recodeye(x)
# }

Run the code above in your browser using DataLab