Learn R Programming

eye (version 1.2.1)

blink: Your data in a blink of an eye

Description

blink summarizes your data tailored to the need of ophthalmic research: It looks for VA and IOP columns and summarises those with common statistics. In order to make it work, it requires specific column naming - please see section "column names" and "data coding". For more details how blink works, see vignette("eye")

Usage

blink(x, va_to = "logmar", va_cols = NULL, iop_cols = NULL, fct_level = 0:4)

Arguments

x

data frame

va_to

to which VA notation (passed to va())

va_cols

if specified, overruling automatic VA columns selection. tidyselection supported

iop_cols

if specified, overruling automatic IOP columns selection. tidyselection supported

fct_level

Remove columns for Summarizing when all unique values fall into range. character or numeric vector, default 1:4

Value

object of class blink and list. Class blink contains the myopized data, count of patients and eyes, and summaries for visual acuities and intraocular pressure.

Data coding

  • Only common codes supported:

  • eyes: "r", "re", "od", "right" - or numeric coding r:l = 0:1 or 1:2

  • Visual acuity: "VA", "BCVA", "Acuity"

  • Intraocular pressure: "IOP", "GAT", "NCT", "pressure"

Column name rules

  • No spaces!

  • Do not use numeric coding for eyes in column names

  • Separate eye and VA and IOP codes with underscores ("bcva_l_preop", "VA_r", "left_va", "IOP_re")

  • Avoid separate VA or IOP codes if this is not actually containing VA/ IOP data (e.g. "stableVA" instead of "stable_va", ChangeIOP instead of "change_IOP")

  • Keep names short

  • Don't use underscores when you don't have to. Consider each section divided by an underscore as a relevant characteristic of your variable. ("preop" instead of "pre_op", "VA" instead of "VA_ETDRS_Letters")

  • Use common codes for your patient column (see eyes, section Guessing) (e.g., "pat", "patient" or "ID", ideally both: "patientID" or "patID")

  • Don't be too creative with your names!

Names examples

Good names:

-c("patid", "surgery_right", "iop_r_preop", "va_r_preop", "iop_r", "iop_l")

OK names

-c("Id", "Eye", "BaselineAge", "VA_ETDRS_Letters", "InjectionNumber"): Names are long and there are two unnecessary underscore in the VA column. Better just "VA" -c("id", "r", "l"): All names are commonly used (good!), but which dimension of "r"/"l" are we exactly looking at?

Bad names (eye will fail)

  • c("id", "iopr", "iopl", "VAr", "VAl"): eye won't be able to recognize IOP and VA columns

  • c("id", "iop_r", "iop_l", "stable_iop_r", "stable_iop_l"): eye may wrongly identify the (probably logical) columns "stable_iop" as columns containing IOP data. Better maybe: "stableIOP_l"

  • c("person", "goldmann", "vision"): eye will not recognize that at all

tidy data

blink and myop work more reliably with clean data (any package will, really!). clean data.

column removal

Done with remCols: Removes columns that only contain values defined in fct_levels or logicals from selected columns (currently for both automatically and manually selected columns). fct_levels are removed because they are likely categorical codes.

Details

blink is basically a wrapper around myop, eyes and reveal:

  • Duplicate rows are always removed

  • Column names are prepared for myopization (see myop)

  • VA will always be converted to logmar

See Also

About tidyselection.

How to rename your columns (two threads on stackoverflow.com):

Examples

Run this code
# NOT RUN {
library(eyedata)
blink(amd2)

messy_df <- data.frame( id = letters[1:3],
iop_r_preop = sample(21:23), iop_r_postop = sample(11:13),
iop_l_postop = sample(11:13), iop_l_preop = sample(31:33),
va_r_preop = sample(41:43),  va_l_preop = sample(41:43),
va_r_postop = sample(51:53), va_l_postop = sample(45:47)
)
blink(messy_df)
# }

Run the code above in your browser using DataLab