s-news
[Top] [All Lists]

Re: All possible pair-wsie combinations

To: "sierra.howry" <sierra.howry@sbcglobal.net>
Subject: Re: All possible pair-wsie combinations
From: Sundar Dorai-Raj <sundar.dorai-raj@pdf.com>
Date: Mon, 28 Apr 2003 13:47:58 -0500
Cc: s-news@lists.biostat.wustl.edu
Organization: PDF Solutions, Inc.
References: <005601c30dad$4b6ace60$2930fea9@computer>
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01


sierra.howry wrote:
Users:
I have
a_seq(1:5)
b_seq(1:5)
What is an easy method of finding the twenty five number combinations and allocating to a (25,2) vector where column 1 is a values and column 2 is the b values. I need these index values to pull values from a 5X5 matrix.

Sierra,

See ?expand.grid

expand.grid(a=1:5, b=1:5)

regards,
sundar

P.S. the underscore as assignment has been deprecated so it's best not to use it anymore. See help("<-") for details.


<Prev in Thread] Current Thread [Next in Thread>