Check out example codes for "R grid all possibilites between two vectors". It will help you in understanding the concepts better.

Code Example 1

a <- c(1:10)
b <- c(1:10)

expand.grid(a,b)

Learn ReactJs, React Native from akashmittal.com