
Okay; I think I get it.  One (rather kludgy) way of accomplishing your goal
is as follows:  Let the two matrices which you want to check for being
"isomorphic" be A and B.  Do:

rA <- apply(A,1,paste,collapse=" ")
rB <- apply(B,1,paste,collapse=" ")
cA <- apply(A,2,paste,collapse=" ")
cB <- apply(B,2,paste,collapse=" ")
iso <- all(sort(rA) == sort(rB)) | all(sort(cA) == sort(cB))

Then "iso" will be TRUE if A and B are "isomorphic" and FALSE otherwise.

As you can see, this works by converting the rows and columns of your
matrices to character strings.  This should be OK --- I think that the base
method duplicated.data.frame() works along similar lines --- but it does
seem kludgy to me.

Perhaps someone else will come up with a sexier idea.

     cheers,

         Rolf

On 31/10/12 19:57, Haris Rhrlp wrote:

> i want to check for isomorphish between matrices i will give you an 
> example to see what i want.
>
> 1 -1 -1     1  1  1
> 1  1  1                    1 -1 -1
> -1 -1 1      -1 -1 1
> -1 1 -1     -1 1 -1
> this 2 matrices are isomorphic beacause if i swap the first 2 rows the 
> matrices will be intetical
> next example
>
> 1 -1 -1         -1  1  -1
> 1  1  1                       1  1   1
> -1 -1 1           -1 -1  1
> -1 1 -1                  1 -1 -1
>
> this 2 matrices are isomorphic beacuse if i swap the first 2 columns 
> the matrices will be intetical
>
> i want to write an algorithm to check all the swaps of the rows and 
> all the swaps of the columns
>
> and then if the matrices are indetical then will be isomorphic
>
> *Απο:* Rolf Turner <rolf.turner@xtra.co.nz>
> *Προς:* Haris Rhrlp <haris_r_help@yahoo.com>
> *Κοιν.:* "R-help@r-project.org" <R-help@r-project.org>
> *Στάλθηκε:* 10:53 μ.μ. Τρίτη, 30 Οκτωβρίου 2012
> *Θεμα:* Re: Σχετ: [R] Swap rows and columns in a matrix
>
>
> Unless there is a good reason not to, you should keep discussions
> on-list.
>
> On 31/10/12 08:29, Haris Rhrlp wrote:
>> thank you for your answer but i dont want the transpose of matrix. I 
>> want to swap rows seperatly and columns the same
>
> Then I am afraid that your question is all Greek to me. :-)
>
> You will have to explain --- with a simple example or two --- exactly what
> it is that you want to accomplish.
>
>     cheers,
>
>         Rolf Turner
>>
>> ------------------------------------------------------------------------
>> *Απο:* Rolf Turner <rolf.turner@xtra.co.nz> 
>> <mailto:rolf.turner@xtra.co.nz>
>> *Προς:* Haris Rhrlp <haris_r_help@yahoo.com> 
>> <mailto:haris_r_help@yahoo.com>
>> *Κοιν.:* "R-help@r-project.org" <mailto:R-help@r-project.org> 
>> <R-help@r-project.org> <mailto:R-help@r-project.org>
>> *Στάλθηκε:* 9:17 μ.μ. Τρίτη, 30 Οκτωβρίου 2012
>> *Θεμα:* Re: [R] Swap rows and columns in a matrix
>>
>> On 31/10/12 07:59, Haris Rhrlp wrote:
>> > Dear R users,
>> >
>> > I want a help to write an algorithm for swapping rows and columns 
>> in a matrix
>> >
>> > thanks in advance
>>
>> ?t
>>
>>     (???)
>
>


	[[alternative HTML version deleted]]


