I am trying to use R to perform an operation (ideally with similarly displayed output) such as
> x<-1:6
> y<-1:6
> x%o%y
[,1] [,2] [,3] [
expand.grid
can answer your second question:
expand.grid(1:6,1:6)
expand.grid(1:6,1:6,1:4)
Your first question is easily handled by outer
:
outer(1:6,1:6,"+")
For the others, I suggest you try expand.grid
, although there are specialized combination and permutation functions out there as well if you do a little searching.