在sample()函数之后存储剩余的数字 score=c(22,20,30,12,29,21,18,31,27,29,22,48,13,18,10,11,17,10,22,28,14,19,30,22,9) x

在sample()函数之后存储剩余的数字 score=c(22,20,30,12,29,21,18,31,27,29,22,48,13,18,10,11,17,10,22,28,14,19,30,22,9) x,r,random,vector,sample,R,Random,Vector,Sample,然后不采样值,采样索引 score = c(22,20,30,12,29,21,18,31,27,29,22,48,13,18,10,11,17,10,22,28,14,19,30,22,9) x <- sample(score,size=13,replace=FALSE) y <- # I want y to store the numbers that were left behind after sample() score=c(22,20,30,12,29,21,18,

然后不采样值,采样索引

score = c(22,20,30,12,29,21,18,31,27,29,22,48,13,18,10,11,17,10,22,28,14,19,30,22,9)

x <- sample(score,size=13,replace=FALSE) 
y <- # I want y to store the numbers that were left behind after sample()
score=c(22,20,30,12,29,21,18,31,27,29,22,48,13,18,10,11,17,10,22,28,14,19,30,22,9)

idx这太棒了!非常感谢你!!
score = c(22,20,30,12,29,21,18,31,27,29,22,48,13,18,10,11,17,10,22,28,14,19,30,22,9)

idx <- sample.int(length(score),size=13,replace=FALSE) 
x <- score[idx]
y <- score[-idx]