To create unique combinations, I used to use below SAS code, I would like to know R equivalent of this. Could anyone please help me doing the same in R, I'm very new to R, just exploring.
DATA B ;
DO i = 1 to 2 ;
DO j = 1 to 5 ;
DO k = 1 to 4 ;
OUTPUT ;
END ;
END ;
END ;
RUN ;
DATA B ;
SET B ;
IJK = CATX("-",i,j,k) ;
RUN ;
this will give me the following output:
Obs i j k ijk
1 1 1 1 1-1-1
2 1 1 2 1-1-2
3 1 1 3 1-1-3
4 1 1 4 1-1-4
5 1 2 1 1-2-1
...........
etc