Re: [R] Prevent sequential repeated values in data frame column

2009-08-11 Thread Scott Sherrill-Mix
It's a pretty inefficient way to do things (e.g. 5+ iterations [20 seconds] to find a good sample) but if you're not doing this often I guess you could do something like: checkNeighborEqual<-function(x){ #assuming the final value is not infinity return(any(x==c(x[-1],Inf))) } #fake data x<-

[R] Prevent sequential repeated values in data frame column

2009-08-11 Thread Jon Zadra
Hi, I'm trying to randomize a sequence of trials for an experimental design. The trials consist of values for each of two factors. As is there are 30 combinations of the two factors, and I want them to be ordered randomly but with the requirement that for one of the factors, the value can n