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
expand.grid(1:6,1:6) expand.grid(1:6,1:6,1:4)