Learn R Programming

eye (version 0.1.0)

va: Visual acuity notation conversion

Description

Cleans and converts visual acuity notations (classes) between Snellen (decimal, meter and feet), ETDRS, and logMAR. va detects the VA class and will convert to logMAR as default.

Usage

va(
  x,
  to = "logmar",
  type = NULL,
  from_logmar = TRUE,
  logmarstep = FALSE,
  mixed = FALSE
)

Arguments

x

Vector with visual acuity entries. Must be atomic. Snellen fractions need to be entered with "/"

to

To which class to convert. "etdrs", "logmar" or "snellen" - any case allowed

type

To which Snellen notation to convert: "m", "dec" or "ft"

from_logmar

chose logmar when guessing between two notations (logmar vs. snellen decimal or logmar vs. etdrs)

logmarstep

how +/- entries are evaluated. FALSE: increase/decrease Snellen fractions by lines. TRUE: plus/minus entries equivalent to 0.02 logmar or 1 ETDRS letter

mixed

TRUE Elements will be converted one by one. Most plausibility checks will be overruled!

Value

vector of va class. See also "VA classes"

VA conversion

  • logMAR to ETDRS: logMAR rounded to the first digit and converted with the chart.

  • Snellen to logMAR: logMAR = -1 * log10(snellen_frac)

  • Snellen to ETDRS: ETDRS = 85 + 50 * log10(snellen_frac) Gregori et al..

  • ETDRS to logMAR: logMAR = -0.02 * etdrs + 1.7 Beck et al.

  • Hand movements and counting fingers are converted following Schulze-Bonsel et al.

  • (No) light perception are converted following the suggestions by Michael Bach

  • To Snellen: Although there seems to be no good statistical reason to convert back to Snellen, it is a very natural thing to eye specialists to think in Snellen. A conversion to snellen gives a good gauge of how the visual acuity for the patients are. However, back-conversion should not be considered an exact science and any attempt to use formulas will result in very weird Snellen values that have no correspondence to common charts. Therefore, Snellen matching the nearest ETDRS and logMAR value in the va_chart are used.

Accepted VA formats

  • Snellen fractions (meter/ feet) need to be entered as fraction with "/".

  • when converting to ETDRS or logMAR: any fraction is allowed , e.g. 3/60 and 2/200 will also be recognized.

  • When converting between Snellen fractions: has to be either 6/ or 20/. Other fractions will not be recognized - see "Examples"

  • ETDRS must be integer-equivalent between 0 and 100 (integer equivalent means, it can also be a character vector)

  • logMAR must be between -0.3 and 3.0

  • Qualitative must be either of PL, LP, NLP, NPL, HM, CF (any case allowed)

  • Any element which is not recognized will be converted to NA

  • Vectors containing several notations ("mixed") are guessed and converted element by element with which_va_dissect and va_dissect

VA detection

  • Internally done with which_va() based on the following rules

  • if x integer and 3 < x <= 100: etdrs

  • if x integer and 0 <= x <= 3: logmar, but you can choose etdrs

  • if x numeric and -0.3 <= x <= 3: logmar

  • if x numeric and all x in intersection(va_chart$logMAR, va_chart$snellen_dec): logmar, but you can choose snellen

  • non-mixed class: if all x in va_chart$snellen_dec: snellen

  • mixed class (which_va_dissect): snellen_dec not supported.

  • if character and format x/y: snellen (fraction)

  • if one of "CF", "HM", "LP", "PL", "NLP", or "NPL": quali

  • if numeric x beyond the ranges from above: NA

  • Any other string or NA: NA

Detection and conversion is on a vector as a whole by which_va(). If a "mixed" VA notation is found, which_va_dissect() and va_dissect() will be called instead for each VA vector element individually.

Problematic cases

There can be ambiguous cases for detection (detection defaults to logmar): x is one of 0,1,2,3 - This can be ETDRS and logMAR. x is one of c(1.5, 1, 0.8, 0.5, 0.4, 0.3, 0.2, 0.1, 0) - This can be snellen decimal or logMAR.

snellen decimals are a particular challenge and va may wrongly assign logMAR - this could happen if there are unusual snellen decimal values in the data which are not part of va_chart. E.g., check the values with unique(x).

Snellen "+/-" entries

By default, plus/minus entries are evaluated as intended by the test design: Snellen fractions increase/decrease only by lines.

- if entry -1 to +3 : take same Snellen value
- if <= -2 : take Snellen value one line below
- if >+3 (unlikely, but unfortunately not impossible):

If logmarstep = TRUE, each snellen optotype will be considered equivalent to 0.02 logmar or 1 ETDRS letter (assuming 5 letters in a row in a chart)

VA cleaning

For more details see clean_va()

  1. NA is assigned to strings such as "." or "", "n/a" or " "

  2. notation for qualitative entries is simplified.

VA classes

convert_VA returns a vector of three classes:

  1. va

  2. One of snellen, logmar, etdrs or quali.

  3. Either of character (for Snellen and qualitative), numeric (for logMAR), or integer (for ETDRS).

Details

Each class can be converted from one to another, and va() converts to logMAR by default. In case of ambiguous detection, logMAR is selected as default, or the other alternative is selected with from_logmar = FALSE.

See Also

Other VA converter: snellen_steps, va_dissect(), va_methods, which_va()

Other VA cleaner: clean_va()

Examples

Run this code
# NOT RUN {
## will automatically detect VA class and convert to logMAR by default
## ETDRS letters
x <- c(23, 56, 74, 58)
va(x)

## ... or convert to snellen
va(x, to = "snellen")

## snellen, mixed with categories. Also dealing with those "plus/minus" entries
va(c("NLP", "NPL", "PL", "LP", "HM", "CF", "6/60", "20/200", "6/9",
 "20/40", "20/40+3", "20/50-2"))

## 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)

## Any fraction is possible, and empty values
x <- c("CF", "3/60", "2/200", "", "20/40+3", ".", "      ")
va(x)

## but this not any fraction when converting from one class to the other
x <- c("3/60", "2/200", "6/60", "20/200", "6/9")
va(x, to="snellen", type = "m")
# }

Run the code above in your browser using DataLab