I have two vectors like this:
f1=c('a','b','c','d')
e1=c('e','f','g')
There is 4^3 different permutations of them. I need to create all of possible permutations of them in R softeware.for example;
(1):
a e
a f
a g
(2):
a e
a f
b g
...
Moreover, my real data are very huge and I need speed codes.
It sounds like you are looking for expand.grid
.
> expand.grid(f1, e1)
Var1 Var2
1 a e
2 b e
3 c e
4 d e
5 a f
6 b f
7 c f
8 d f
9 a g
10 b g
11 c g
12 d g
I don't know what "speed codes" are, so I'm not sure I can help from that aspect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With