[R] combination

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Thu Apr 13 03:49:04 CEST 2017


?expand.grid
-- 
Sent from my phone. Please excuse my brevity.

On April 12, 2017 6:28:24 PM PDT, Val <valkremk at gmail.com> wrote:
>Hi all,
>I have two variables x and y. X has five observation and y has three.
>I want combine each element of x to  each element of y values to
>produce 15  observation. Below is my sample data and desired output
>
>data
>x   Y
>1   A
>2   B
>3   C
>4
>5
>
>Output
>1  A
>1  B
>1  C
>2  A
>2  B
>2  C
>3  A
>3  B
>3  C
>4  A
>4  B
>4  C
>5  A
>5  B
>5  C
>
>Thank you in advance
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list