Hi, i am working on a problem where i need to compute the products of all possible combinations of size m of the elements of a vector. I know that this can be achieved using the function combn(), e.g.:
> vector <- 1:6 > combn(x = vector, m = 3, FUN = function(y) prod(y)) In my case the vector has 2000 elements and i need to compute the values specified above for m = 32. Using combn() i encounter problems for m >= 4. Is there any alternative to combn() that works more efficiently? Also my vector contains many duplicates, so there are actually only about 300 distinct values in the vector. This reduces the number of possible combinations significantly. Is there any way to use this fact to reduce the computational cost? Thanks in advance, El -- View this message in context: http://n4.nabble.com/More-efficient-alternative-to-combn-tp1692117p1692117.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.