HI, Not sure whether this is what you wanted.
vec1<- 1:7 fun1<- function(x,nr) {((x-1)%/%nr)+1} fun1(vec1,2) #[1] 1 1 2 2 3 3 4 fun1(vec1,3) #[1] 1 1 1 2 2 2 3 split(vec1,fun1(vec1,2)) A.K. ----- Original Message ----- From: Witold E Wolski <wewol...@gmail.com> To: r-help@r-project.org Cc: Sent: Wednesday, July 17, 2013 5:43 PM Subject: [R] cut into groups of equal nr of elements... I would like to "cut" a vector into groups of equal nr of elements. looking for a function on the lines of cut but where I can specify the size of the groups instead of the nr of groups. -- Witold Eryk Wolski ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.