Jordi

try this


R> x <- c(1,2,3, 10,11,12, 41,42,43, 81,82,83) R> dim(x) <- c(3,4) R> x [,1] [,2] [,3] [,4] [1,] 1 10 41 81 [2,] 2 11 42 82 [3,] 3 12 43 83 R> jj <- t(apply(x,1,sample)) R> jj [,1] [,2] [,3] [,4] [1,] 1 41 10 81 [2,] 2 11 82 42 [3,] 12 3 43 83 R> as.vector(jj) R> [1] 1 2 12 41 11 3 10 82 43 81 42 83




and I think that does what you want...

We take the vector, rearrange it into a matrix with three rows, then sample *within* the rows,
then rearrange into a vector again.


There will be one forbidden permutation, namely the identity (which may or may not be
desirable).


This method doesn't allow "intra block" permutations.

best

rksh



Dear R users,
First of all, thanks for the incredibly fast answers and help of Rolf, Marc and Robert.
Yes, I noticed that it was a lot of permutacions, but my intention was to make this process automatic and take only 5.000 - 10.000 permutations. Therefore, I wanted only to take that "interesting permutations" with "some information" [inter-block permutations].
The reason why I'm interested in these permutations is because I'm using some packages of Bioconductor to analyse my data from some microarrays and I thought that perhaps could be interesting to see what happens when I permute my data and I compare it against the not permuted data.
Thanks again for your time and suggestions.


Jordi Altirriba
Ph. D. Student

Hospital Clinic-Barcelona-Spain

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


--
Robin Hankin
Uncertainty Analyst
Southampton Oceanography Centre
SO14 3ZH
tel +44(0)23-8059-7743
[EMAIL PROTECTED] (edit in obvious way; spam precaution)

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to