Talk:FirstPrinciples.R
From Organic Design wiki
Hi Vinoy, It's better to keep the discussions on the list for other users that may have the same question. If they are not evenly spaced, after the normalizations you can rearrange the MA object so that they are evenly spaced, at least the 90% that are spotted twice. The ones that are spotted 26 times are likely some sort of control spots, and you can probably safely ignore them. Why are some spotted three times? If you want to keep these genes in, a quick-and-dirty solution would be to just pick two of the three spots. The following code *should* work to rearrange the order of the genes, then pick out the first two spots for each unique ID. MA.norm <- MA.norm[order(MA.norm$genes$ID),] x <- unique(MA.norm$genes$ID) MA.norm$genes$spotrep <- NULL # I'm sure there's a better, faster way to do the following, but this is the only way I know how: for (i in 1:length(x)) { y <- which( MA.norm$genes$ID == x[i] ) MA.norm$genes$spotrep[y] <- 1:length(y) } MA.norm.2spot <- MA.norm[MA.norm$genes$spotrep <= 2 , ] # now your spacing=1 and ndups=2 HTH, Jenny
Alternative approach:
sort(unlist(tapply(1:10, rep(1:2, each=5), sample,2)))