This does what I needed. However, as the output is a list object, is there any way to apply a function to such object? For example if I want to compute the mean for the 4th subvectors, I can't simply use: ##### Y=split(X,as.numeric(gl(length(X),3,length(X)))) mean(Y[4]) ##### as the error message shows "argument is not numeric or logical"
-- View this message in context: http://r.789695.n4.nabble.com/Splitting-a-vector-tp4681930p4681987.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.