convert.continuous.to.binary: Converts a continuous variable to a binary one. Zero or...

Description Usage Arguments Value

Description

Converts a continuous variable to a binary one. Zero or negative values of the continuous variable will be considered to have the first level of the variable.

Usage

1
2
3
4
5
6
7
convert.continuous.to.binary(
  data.dt,
  max.chance = 0.5,
  var.levels = c(0, 1),
  delete.outcome.orig = T,
  delete.prob = T
)

Arguments

data.dt

data.table with minimally participant ID and outcome.

max.chance

The chance that the highest value of the continuous variable will be assigned the second level of the binary variable. (Default: 0.5)

var.levels

Vector containing the values that the binary outcome will assume (Default: c(0,1))

delete.outcome.orig

Delete original continuous outcome (Default: TRUE)

delete.prob

Delete calculated probability of var.levels[2] (Default: TRUE)

Value

A data.table with the continuous outcome column replaced by the specified binary variable. Not necessary to use return value, as data.dt will be modified by reference,


mattmoo/SteppedWedgeAnalysis documentation built on Jan. 14, 2020, 12:25 a.m.