Re: [R] How to get all combinations between two character vectors?

From: David L Lorenz <>
Date: Fri, 11 Mar 2011 08:31:18 -0600

  The are probably lots of ways, I'd use

levels(interaction(c("a", "b"), c('x', 'y'), sep=''))


>I know there is a function - I have used it before - but I always forget
>what it is called...
>I need the combination of two character vectors, i.e:
>x <- c("a", "b")
>y <- c("x", "y")
>z <- THEFUNCTION(x, y)
>z == c("ax", "ay", "bx", "by")
>I promise I will write the name of the function on my desk!

        [[alternative HTML version deleted]] mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Fri 11 Mar 2011 - 14:36:53 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 11 Mar 2011 - 14:40:22 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive