Created
January 9, 2023 10:47
-
-
Save cindyangelira/2d0a6cd195e65e8dba909ea91e24d4db to your computer and use it in GitHub Desktop.
survival data preprocessing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pre processing---- | |
df <- df %>% select(-6) | |
colnames(df)[c(4,5,6)] <- c("age", "begin", "disease") | |
# Encoding the categorical feature---- | |
library(caret) | |
dmy <- dummyVars(" ~ .", data = df) | |
df_clean <- data.frame(predict(dmy, newdata = df)) %>% select(-c(1,6)) | |
head(df_clean) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment