An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-help/attachments/20051102/1687c9f3/attachment.pl
help : matrix row/column random mixing
3 messages · booop booop, Martin Maechler, Dave Roberts
"booop" == booop booop <booopi at yahoo.com>
on Wed, 2 Nov 2005 13:22:55 -0800 (PST) writes:
booop> Could anybody help me in mixing the matrix values
booop> randomly (first rows and then columns)... for eg
booop> putting the 1 st row in the place of 3 rd and 3rd in
booop> place of 4 th and 4th in place of 1st row
booop> ...something like this in columns also..
booop> Please suggest me some ways..
booop> thanks a lot..
booop> with regards, boopathy.
Quite a few of us don't like such completely anonymous postings.
At least tell us a "who you are" in your signature....
... and
booop> ---------------------------------
booop> [[alternative HTML version deleted]]
booop> ______________________________________________
booop> R-help at stat.math.ethz.ch mailing list
booop> https://stat.ethz.ch/mailman/listinfo/r-help
booop> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Indeed, please do read it!
There are several bootstrap packages available at CRAN that probably provide an elegant solution, but simply permuting the matrix is pretty easy > data <- matrix(1:100,nrow=5) # matrix of 5 rows and 20 columns > x <- data[sample(1:5),] # permute the rows > y <- x[,sample(1:20)] # permute the columns to really scamble the matrix > z <- matrix(sample(data),nrow=5) Dave R.
booop booop wrote:
Could anybody help me in mixing the matrix values randomly (first rows and then columns)... for eg putting the 1 st row in the place of 3 rd and 3rd in place of 4 th and 4th in place of 1st row ...something like this in columns also.. Please suggest me some ways.. thanks a lot.. with regards, boopathy. --------------------------------- [[alternative HTML version deleted]]
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ David W. Roberts office 406-994-4548 Professor and Head FAX 406-994-3190 Department of Ecology email droberts at montana.edu Montana State University Bozeman, MT 59717-3460