hyperop: Hyperopic eye data

Description Usage Arguments Details Value See Also Examples

View source: R/hyperop.R

Description

Pivot eye-related variables to two columns

Usage

1
hyperop(x, cols, eye = NULL)

Arguments

x

data frame

cols

columns which should be made "wide". Tidyselection supported

eye

eye column (default looking for "eye" or "eyes", all cases)

Details

Basically the opposite of myop() - a slightly intelligent wrapper around tidyr::pivot_longer() and tidyr::pivot_wider() Will find the eye column, unify the codes for the eyes (all to "r" and "l") and pivot the columns wide, that have been specified in "cols".

Good names and tidy data always help!

For more information about shaping data and good names, see vignette("eye"), or ?blink or ?myop

Value

A tibble, see also tibble::tibble

See Also

About tidyselection

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Example to clean a bit messy data frame

iopva <- data.frame(
  id = c("a", "e", "j", "h"),
  va_r = c(37L, 36L, 33L, 38L),
  iop_r = c(38L, 40L, 33L, 34L),
  va_l = c(30L, 39L, 37L, 40L),
  iop_l = c(31L, 34L, 33L, 31L)
)
myop_iop <- myop(iopva)
hyperop(myop_iop, cols = matches("va|iop"))

eye documentation built on Sept. 5, 2021, 5:25 p.m.