dfMergeTwoVariablesRelevel: Merge two variables into one, optionally map values to new...

Description Usage Arguments Value Examples

View source: R/utils.R

Description

Merge two variables into one, optionally map values to new levels

Usage

1

Arguments

df

A data.frame in which there are two variables (columns) to be merged into one.

colnames

A vector of length two with names of the two columns that hold the variables to be merged. See colnames for how to obtain the names of columns of a data frame.

levelslist

A list with one slice each for a new value to be used for a vector of old values (optional).

...

for deprecated varnames parameter (will be removed)

Value

A vector of strings

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
statusvalues <- list(
  "ongoing" = c("Recruiting", "Active", "Ongoing",
                "Active, not recruiting", "Enrolling by invitation"),
  "completed" = c("Completed", "Prematurely Ended", "Terminated"),
  "other" = c("Withdrawn", "Suspended",
              "No longer available", "Not yet recruiting"))

dfMergeTwoVariablesRelevel(
  df = result,
  colnames = c("Recruitment", "x5_trial_status"),
  levelslist = statusvalues)

## End(Not run)

ctrdata documentation built on Nov. 22, 2021, 1:06 a.m.