Skip to content
Back to formatted view

Raw Message

Message-ID: <200212110411.gBB4B3X18184@r.hankin.sges.auckland.ac.nz>
Date: 2002-12-11T05:19:06Z
From: robin hankin
Subject: ordering x's and y's
In-Reply-To: <004501c2a12f$195d3970$c8d994cb@andrewvhowclyz> (arc@arcriswell.com)

Hi Andrew.

This was asked a few days ago (but I posted my offering offline)..
Try:

library(gregmisc)
do.thing2 <- function(x,y) {
   a <- c(x,y)
   tt <- combinations(length(a),length(x))
   answer <- matrix(NA,nrow(tt),length(a))
   for(i in 1:nrow(tt)) {
     answer[i, tt[i,]] <- x
     answer[i,-tt[i,]] <- y
   }
return(answer)
}

[anyone got a vectorized version?]


best

rksh



-- 

Robin Hankin, Lecturer,
School of Geography and Environmental Science
Tamaki Campus
Private Bag 92019 Auckland
New Zealand

r.hankin at auckland.ac.nz
tel 0064-9-373-7599 x6820; FAX 0064-9-373-7042

as of: Wed Dec 11 17:08:00 NZDT 2002
This (linux) system up continuously for:  468 days, 22 hours, 50 minutes