[R] splitting vector into equal sets
utkarshsinghal
utkarsh.singhal at global-analytics.com
Thu Apr 16 15:23:15 CEST 2009
Hi R,
I have explored R archives a lot but couldn't find an efficient way of
doing the following:
I want to split a vector into sets of equal sizes. Is there any inbuilt
function of doing so with the option of specifying how to treat the
remaining observations. For example: suppose I want to split 20
observations in 3 groups, then I also want the option to put the extra
two observations into the 1st group or the last group or one in each
group starting from 1st or starting from last.
I have already tried the "cut" & the "quantcut" function but of no use.
Any help will be appreciated. Note that I am looking for an R function
rather than lines of code.
Regards
Utkarsh
More information about the R-help
mailing list