neringab
neringab

Reputation: 645

All possible combinations for large numbers in R

Image i have a sequence like this:

seq <- rep(0:9, 10)

I want to know all possible combinations of this sequence. For sure, command combn isn't working:

> comb <- combn(seq, 10)
Error in matrix(r, nrow = len.r, ncol = count) : 
  invalid 'ncol' value (too large or NA)
In addition: Warning message:
In combn(seq, 10) : NAs introduced by coercion to integer range

Can you give me a hint how to make my own function for all possible combinations?

Upvotes: 1

Views: 1322

Answers (1)

Ram K
Ram K

Reputation: 1785

Based on your reply to the comment , here is one thing you can do . You need the combinat package installed for this to work.

library(combinat)
seq <- c(1,2,3,4,5,6,7,8,9,0)
permn(seq)

Upvotes: 2

Related Questions