ji.changerefgroup.ds: changes a reference level of a factor

Description Usage Arguments Value Author(s) Examples

Description

this function is similar to R function relevel, but in addition addes numbering to the levels so that they are displayed in the right order when creating cross-tables.

Usage

1
  ji.changerefgroup.ds(xvect, ref = NULL)

Arguments

xvect

a factor

ref

the reference level

Value

a factor of the same length as xvect

Author(s)

Isaeva, J.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
# load the login data
data(logindata)

# login and assign specific variable(s)
myvar <- list("PM_BMI_CATEGORICAL")
library(opal)
opals <- datashield.login(logins=logindata,assign=TRUE,variables=myvar)

# rename the levels of PM_BMI_CATEGORICAL and make "obesity" as a reference level
datashield.assign(opals, 'bmi_new', quote(ji.recodelevels.ds(D$PM_BMI_CATEGORICAL, newlabels=c('normal', 'overweight', 'obesity'))))
datashield.assign(opals, 'bmi_ob', quote(ji.changerefgroup.ds(bmi_new, ref='obesity')))

## End(Not run)

datashield/ji.dev.sv documentation built on May 14, 2019, 7:53 p.m.