Re: [R] removing specific rows from array

2010-09-18 Thread Maas James Dr (MED)
Dr. Jim Maas University of East Anglia From: Michael Bedward [michael.bedw...@gmail.com] Sent: 18 September 2010 04:14 To: Maas James Dr (MED) Cc: r-help@r-project.org Subject: Re: [R] removing specific rows from array Here's one way... treats <- c(&

Re: [R] removing specific rows from array

2010-09-17 Thread Michael Bedward
Here's one way... treats <- c("t0", "t1", "t2", "t3") n <- length(treats) n2 <- choose(n-1, n-2) comb <- matrix("", nrow=n*n2, ncol=n-1) k <- 1 for (i in 1:n) { comb[k:(k+n2-1), ] <- cbind(treats[i], t(combn(treats[-i], n-2))) k <- k + n2 } It doesn't get any marks for conciseness but it shou

[R] removing specific rows from array

2010-09-17 Thread Maas James Dr (MED)
I'm attempting to create an array of treatment comparisons for modelling data generation. This involves comparison of one treatment (c2) with another (c3), relative to a common comparator (c1). Attached code gives me the correct array but need to remove duplicates. Duplicates relate only to c