[R] Randomly split a sample in two equal subsamples

Yoan Mihov yoan.mihov at gmail.com
Sun Oct 31 15:25:14 CET 2010


Dear all,

I would like to randomly split a sample in two equally large
subsamples. The sample data is stored as a matrix with each row
representing an individual and each column representing some variable
(e.g., name, age, sex, etc.); the first row contains the names of the
variables; the first column contains the individual number (1:n, for n
individuals); the number of individuals is even (so, the overall
number of rows is odd).

I found similar threads (like "random subset"), but I don't know how
to apply the information from them in my case. Could somebody help me
a little bit? Thanks in advance!

Yoan



More information about the R-help mailing list