Learn R Programming

eye (version 0.1.0)

eyes: Count patients and eyes

Description

Counts number of patients and eyes (right and left).

eyestr: identical to eyes(x, report = TRUE, ...)

Usage

eyes(x, id = NULL, eye = NULL, report = FALSE, ...)

eyestr(x, id = NULL, eye = NULL, small_num = TRUE, para = FALSE, UK = FALSE)

Arguments

x

required. (data frame)

id

Patient identifying column

eye

Eye identifying column.

report

if TRUE, text returned for report

...

passed to eyes_to_string

small_num

If TRUE: writing numbers <= 12 as words

para

If TRUE: Adding "A total of" to comply with most journal standards and to avoid awkward long numbers.

UK

Logical, Use UK (English) style (TRUE) or USA (American) style (FALSE).

Value

eyes: Named integer vector with count of patients and eyes

eyestr: Character string - can be directly pasted into reports

Guessing

For any below, cases are always ignored (you can write in upper or lower case, as you please)

id and eye arguments overrule the name guessing for the respective columns.

patient ID columns:

  • First, eyes is looking for names that contain both strings "pat" and "id" (the order doesn't matter)

  • Next, it will look for columns that are plainly called "ID"

  • Last, it will search for all names that contain either "pat" or "id"

eye variable column:

  • eyes looks for columns called either "eye" or "eyes"

Eye coding

  • eyes recognizes integer coding 0:1 and 1:2, with right being the lower number. For strings coding it recognizes right eyes: c("r", "re", "od", "right") and left eyes: c("l", "le", "os", "left")

Report

Using eyes_to_string to parse the output of eyes into a text which you can use for reports. Arguments to eyes_to_string are passed via ...:

  • small_num If TRUE (default): numbers <= 12 as words

  • para If TRUE (not default): Adding "A total of" to comply with most journal standards and to avoid awkward long numbers.

  • UK TRUE: UK style (English) or FALSE (default): US style (American).

Details

eyes guesses columns that identify patients and eyes.

Examples

Run this code
# NOT RUN {
eyes(amd)
eyestr(amd, para = TRUE)
# }

Run the code above in your browser using DataLab