Skip to content
Back to formatted view

Raw Message

Message-ID: <48C8C8A8.1020108@stamats.de>
Date: 2008-09-11T07:28:40Z
From: Matthias Kohl
Subject: All possible pairs of two variables
In-Reply-To: <89b6b8c90809102324t1b34eb03w156ef0889ca7feda@mail.gmail.com>

take a look at the code of the function pairwise.table. It shows a way 
using function outer.

hth,
Matthias


Yihui Xie wrote:
> Just simple loops as follows:
>
> ########################
> z = NULL
> for (y in 0:10) {
>     for (x in 0:y) {
>         z = rbind(z, c(x, y))
>     }
> }
> z
> ########################
>
> Yihui
>
> On Thu, Sep 11, 2008 at 12:34 PM, Ron Michael <ron_michael70 at yahoo.com> wrote:
>   
>> I have two variables (x,y) :
>>
>> x : it takes all integer values from 0 to y and,
>> y : takes all values from 0, 10
>>
>> I am looking for some R code to find all possible pairs of (x,y). Can anyone please help me?
>>
>>
>>
>>     
>
>   

-- 
Dr. Matthias Kohl
www.stamats.de