table<- data.frame(pred=c(0.31009564, 0.63558793, 0.49152436, 0.55208678, 0.65151313, 0.61936015, 0.14106961, 0.16343966, 0.53500583, 0.12506695, 0.63486000, 0.21074987, 0.26063249, 0.53500583),
y=c(1,1,1,1,1,1,0,0,0,0,0,0,0,0))
(y_rows1 <- which(table$y == 1))
(y_rows0 <- which(table$y == 0))
#if you want 14 rows ; 7 of which are y==1 and 7 of which are y==0
set.seed(42)
(y_rows_1_s <- sample(y_rows1 ,size=7,replace=TRUE))
(y_rows_0_s <- sample(y_rows0 ,size=7,replace=TRUE))
(table_s <- table[c(y_rows_1_s,y_rows_0_s),
])
#if you want 14 rows 3 of which are y==1 and 11 of which are y==0
set.seed(42)
(y_rows_1_s <- sample(y_rows1 ,size=3,replace=TRUE))
(y_rows_0_s <- sample(y_rows0 ,size=11,replace=TRUE))
(table_s <- table[c(y_rows_1_s,y_rows_0_s),])