make_Dummy {cmpp} | R Documentation |
Create Dummy Variables
Description
This function creates dummy variables for specified features in a dataset.
Usage
make_Dummy(Data = dat, features = c("sex", "cause_burn"), reff = "first")
Arguments
Data |
A data frame containing the data. |
features |
A character vector of feature names for which dummy variables are to be created. |
reff |
A character string indicating the reference level. It can be either "first" or "last". |
Value
A list containing two elements:
New_Data |
A data frame with the original data and the newly created dummy variables. |
Original_Data |
The original data frame. |
Examples
dat <- data.frame(sex = c('M', 'F', 'M'), cause_burn = c('A', 'B', 'A'))
result <- make_Dummy(Data = dat, features = c('sex', 'cause_burn'), reff = "first")
print(result$New_Data)
[Package cmpp version 0.0.2 Index]