R语言:数据集分割

安装补充包

划分训练集和验证集

1
2
3
4
5
6
library("caTools")
dat <- readRDS('../data/dat.rds')
set.seed(123)
split = sample.split(substr(rownames(dat),1,2),SplitRatio = .8)
train_data = subset(dat, split == TRUE)
test_data = subset(dat, split == FALSE)

R语言:数据集分割
https://b.limour.top/1991.html
Author
Limour
Posted on
August 19, 2022
Licensed under