| To: | "S-News" <s-news@lists.biostat.wustl.edu> |
|---|---|
| Subject: | Permuting a data frame |
| From: | "Walter R. Paczkowski" <dataanalytics@earthlink.net> |
| Date: | Tue, 21 Jun 2005 13:04:00 +0000 |
| Domainkey-signature: | a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=Eem1uEovud8WDphRcUTNZsGsQLCpTuN73+Z3Ww5fuYPviHETQV1w7f9bf9si3AFf; h=Received:Subject:From:To:Disposition-Notification-To:Date:Content-Type:Organization:Content-Transfer-Encoding:MIME-Version:Message-ID:X-ELNK-Trace:X-Originating-IP; |
| Organization: | Data Analytics Corp. |
Good morning, I have a trivial problem. I want to permute the rows of a data frame with, say, five columns, each column having the same sequence of numbers, 1:n. For example, I want to permute x1 x2 x3 x4 x5 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 But, after the permutation, there can be no duplications in each row and, of course, each number in each column can appear only once in that column of the resulting data frame . So, I would like something like x1 x2 x3 x4 x5 1 5 4 3 2 2 1 5 4 3 3 2 1 5 4 4 3 2 1 5 5 4 3 2 1 except the problem I'm working on has 30 rows with five columns. Is there an easy way to do this? I tried the repeated application of sample with any and duplicated to check for the duplications, but this is very inefficient. Thanks, Walt Paczkowski ________________________ Walter R. Paczkowski, Ph.D. Data Analytics Corp. 44 Hamilton Lane Plainsboro, NJ 08536 (V) 609-936-8999 (F) 609-936-3733 |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | How can I remove the intercept fromt he conditional variance equation, Samir Saadi |
|---|---|
| Next by Date: | Re: Permuting a data frame, Dimitris Rizopoulos |
| Previous by Thread: | How can I remove the intercept fromt he conditional variance equation, Samir Saadi |
| Next by Thread: | Re: Permuting a data frame, Dimitris Rizopoulos |
| Indexes: | [Date] [Thread] [Top] [All Lists] |