powered by
This function creates dummy variables for specified features in a dataset.
make_Dummy(Data = dat, features = c("sex", "cause_burn"), reff = "first")
A list containing two elements:
A data frame with the original data and the newly created dummy variables.
The original data frame.
A data frame containing the data.
A character vector of feature names for which dummy variables are to be created.
A character string indicating the reference level. It can be either "first" or "last".
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)
Run the code above in your browser using DataLab