On Apr 5, 2010, at 4:58 PM, Ayush Raman wrote:

Hi all,

How can I have a permuted matrix where the second row is the permutation over the first row ; third is the permutation of the second row; forth is
the permutation of the third row and so on ?

Wouldn't any of those permutations just be a permutation of the first row? Perhaps something like:


M <- matrix(first_row, length(first_row), length(first_row))
M[1, ] <- first_row
M[2:length(first_row), ] <- rbind(
          t(sapply(2:length(first_row), function(x) {
sample(first_row, length(first_row), replace=FALSE) }
            )     )
                                 )



--

David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to