[R] ordering x's and y's
Robin Hankin
r.hankin at auckland.ac.nz
Wed Dec 11 05:19:06 CET 2002
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
More information about the R-help
mailing list