[R] combination of different vector values

Wiener, Matthew matthew_wiener at merck.com
Fri Jun 14 20:20:05 CEST 2002


Take a look at expand.grid.  It sounds like it might solve your problem.

Hope this helps,
Matt

-----Original Message-----
From: Ngayee.Law at celeradiagnostics.com
[mailto:Ngayee.Law at celeradiagnostics.com]
Sent: Friday, June 14, 2002 1:16 PM
To: r-help at stat.math.ethz.ch
Subject: [R] combination of different vector values


Hi,

Thanks in advance for the help.

I have a few vectors and I need to get all the combinations of the vector
values.
Normally I would use a few for-loops to do that.
e.g  x1_c(1,3,5)
     x2_c(2,5,6)
     for (i in x1) {
       for (j in x2) {
          ...
     }}

My problem is that I don't know how many vectors there are ahead of time,
so
I don't know how many for-loops I need. Any ideas how to implement this?

- Jacqueline




-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._

------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message.  If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it.

==============================================================================

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list