Re: [R] split dataset randomly in prediction and validation set

2009-02-05 Thread Dieter Menne
Els Verfaillie ugent.be> writes: > For a geostatistical analysis, I would like to split my dataset randomly > into 2 parts: a prediction set (with 2/3 of my data) and a validation set > (with 1/3 of my data). Both datasets will thus contain different data. Any > suggestions? Normally, you will

Re: [R] split dataset randomly in prediction and validation set

2009-02-05 Thread jim holtman
?sample > x <- 1:100 # test data > y <- split(x, sample(1:2, length(x), replace=TRUE, prob=c(1,2))) > > y $`1` [1] 4 6 7 13 15 17 18 20 21 29 35 36 37 39 41 43 46 49 50 52 61 68 70 72 76 77 79 80 82 85 87 94 95 96 99 $`2` [1] 1 2 3 5 8 9 10 11 12 14 16 19 22 23 24 25 2