trt_widify: Long to wide format of test-retest data

Description Usage Arguments Value Examples

View source: R/trt.R

Description

Convenience function to turn long-format test-retest data to wide format.

Usage

1
trt_widify(data, values, cases, rater = NULL)

Arguments

data

The total data frame

values

Column of the measured values (quoted character)

cases

Column of the individual values, i.e. individuals/measured items (character)

rater

Optional. Column of the rater/which measurement, i.e. measurement 1 and measurement, or raters 1, 2 and 3. If this is not specified, the function will assume that the values are in order by rater, or that it the order doesn't matter.

Value

A tibble containing the test-retest data in wide format.

Examples

1
2
3
4
5
6
7
library(tidyverse)
data("petVT", package = 'agRee')
amy <- as.data.frame(petVT$amygdala)
amy_l <- gather(amy) %>%
  mutate(indiv = rep(paste0('s', 1:11), times=2))

trt_widify(amy_l, 'value', 'indiv', 'key')

mathesong/relfeas documentation built on March 4, 2020, 5:29 a.m.