You can also do:
outer(c("a", "b"), c("c", "d"), FUN = "paste0")[1:4] [1] "ac" "bc" "ad" "bd"
Both do.call and outer are valuable features to reproduce. :)
Alternatively, we can designate
x <- outer(c("a", "b"), c("c", "d"), FUN = "paste0") dim(x) <- NULL x [1] "ac" "bc" "ad" "bd"
Without knowledge of length.
Additional changes!
x <- outer(c("a", "b"), c("c", "d"), FUN = "paste0") y <- t(x) dim(y) <- NULL y [1] "ac" "ad" "bc" "bd"
Gets the order you need.
Adam hyland
source share