outer( c("aa", "ab", "cc"), c("aa", "ab", "cc") , "paste" ) # [,1] [,2] [,3] #[1,] "aa aa" "aa ab" "aa cc" #[2,] "ab aa" "ab ab" "ab cc" #[3,] "cc aa" "cc ab" "cc cc"