So I've seen similar versions of this question asked before (Getting all combinations which sum up to 100 using R) but I'm struggling to find a way to figure out what I need to run specifically. I'm trying to create a list in R of all the different combinations of 6 numbers that add up to 10. However, I want to include 0s and repeats of the same # in the row. So it would look something like this:
10 0 0 0 0 0
9 1 0 0 0 0
8 2 0 0 0 0
I've tried running the following:
C = t(restrictedparts(10,6, include.zero=TRUE))
ComboSet<-data.frame(do.call(rbind, lapply(1:nrow(C),function(i) getall(iterpc(table(C[i,]), order=T)))))
However, when I do this it does not seem to include the variations that have 0s in them. I've tried entering the include.zero=TRUE function into different parts of what I'm running but I've had no luck so far. Any suggestions?