library(caret) partition_idx <- createDataPartition (x$危覿, p=0.3)$Resample1 training <- x[partition_idx, ] test <- x[-partition_idx, ]
library(caret) tmp <- downSample(subset(x, select = -危覿), factor(dataset$危覿)) tmp <- upSample(subset(x, select = -危覿), factor(dataset$危覿))