
recoding eyes to "r" and "l"
recodeye(x, to = NULL, eyecodes = NULL, dropunknown = TRUE)
Character vector
recodeye will automatically detect the following strings: right = c("r", "re", "od", "right"), left = c("l", "le", "os", "left"), both = c("b","both","ou")
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.
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.
Other string matching functions:
getElem
,
set_codes()
,
sort_substr()
,
str_func_facs
# 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