## calling va without specifying "to" will clean visual acuity entries
## without conversion into another notation. Weird entries will be
## replaced by a missing value that R recognises as such
x <- c(23, "", NA, "N/A", "Not measured", "20/50", 74, 58)
va(x)
## ... or convert to snellen
va(x, to = "snellen")
## Dealing with those "plus/minus" entries, and qualitative values such as "HM"
va(c("NLP", "NPL", "PL", "LP", "HM", "CF", "6/60", "20/200", "6/9",
"20/40", "20/40+3", "20/50-2"), to = "snellen")
## A mix of notations is also possible
x <- c("NLP", "0.8", "34", "3/60", "2/200", "20/40+3", "20/50-2")
va(x, to = "snellen")
## Any fraction is possible, and empty values
## change Snellen type to meter with type = "m"
x <- c("CF", "3/60", "2/200", "", "20/40+3", ".", " ")
va(x, to = "snellen", type = "m")
Run the code above in your browser using DataLab