blink: Your data in a blink of an eye

Description Usage Arguments Details Value Data coding Column name rules Names examples tidy data column removal See Also Examples

View source: R/blink.R

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

1
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

Details

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

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

Column name rules

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)

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.

See Also

About tidyselection.

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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)

tjebo/eye documentation built on Jan. 24, 2022, 8:34 p.m.