Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

Multiple random samples without replacement in R

$
0
0

I have a vector of size M = 2630, How can I draw 4 samples of size M/4. The following code is not working

M <- c(1:2630)
mysample <- split(sample(M), 1:(length(M)/4))

Since (length(M)/4) is not an integer, So I would like to make three samples of equal size and the fourth will have the rest of the units. Three samples can be of size 657 and the fourth one can be 659.

Any help is appreciated


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>