splitting vector into equal sets
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