variable.update: Update variable

View source: R/variable.update.R

variable.updateR Documentation

Update variable

Description

Update one or more variable(s) in a DIGRAM Object.

Usage

variable.update(
  do = NULL,
  variable.to.update = NULL,
  variable.name = NULL,
  variable.label = NULL,
  category.names = NULL,
  variable.type = NULL,
  minimum = NULL,
  maximum = NULL,
  cutpoints = NULL,
  reverse = NULL
)

Arguments

do

A digram.object

variable.to.update

The number or name of the variable(s) which should be updated

variable.name

New name for the variable (string)

variable.label

New label for the variable (one or more uppercase letters)

variable.type

Type of variable ("ordinal" or "nominal")

minimum

Smallest value of the variable (lower values are coded NA)

maximum

Largest value of the variable (lower values are coded NA)

cutpoints

Cutpoints used to recode the variable Category 1: minimum <= values <= cutpoint(1) Category 2: cutpoint(1) < values <= cutpoint(2) ... Category N: cutpoint(n) < values <= maximum

reverse

Boolean. Reverse values (after cutpoints applied).

Details

A set of variables can be updated by providing a vector of variable names/numbers to update and ordered lists with their new properties. For variable.type, cutpoints, minimum and maximum you can provide one property to give all variables.

Value

Returns a DIGRAM object with (an) updated variable(s)

Author(s)

Jeppe Bundsgaard jebu@edu.au.dk

References

Kreiner, S. (2003). Introduction to DIGRAM. Dept. of Biostatistics, University of Copenhagen.

Examples

data(DHP)
DHP<-variable.update(do=DHP,variable.to.update="dhp36",cutpoints=c(2,3))
DHP<-variable.update(do=DHP,variable.to.update=c(1,3),variable.label=list("32","36"))


jeppebundsgaard/RDigram documentation built on Oct. 29, 2023, 7:15 p.m.