[R] Help to make a program

Ronaldo Reis Jr. chrysopa at insecta.ufv.br
Sat Apr 26 19:18:38 CEST 2003


Hi all,

I try to make a program for comparison between matrix cells.

Here um simple example:

3 |a b a
2 |b b b
1 |a b a
  -------
   1 2 3

This is tabulated like this:

x y sp
1 1 a
1 2 b
1 3 a
2 1 b
2 2 b
2 3 b
3 1 a
3 2 b
3 3 a

Then, I need to make the follow calcule:

==============================================
Change in sp levels from 1x1 area to 2x2 area:
----------------------------------------------
from (1:1) to (1:2) change of the "a" to "b"
change count = 1

from (1:1) to (2:2) change of the "a" to "b"
change count = 1

from (1:1) to (2:1) change of the "a" to "b"
change count = 1
----------------------------------------------
Total change counts = 3
==============================================

==============================================
Change in sp levels from 2x2 area to 3x3 area:
----------------------------------------------
from (1:2) to (1:3) change of the "b" to "a"
change count = 1

from (1:2) to (2:3) change of the "b" to "b" (not change)
change count = 0

from (2:2) to (1:3) change of the "b" to "a"
change count = 1

from (2:2) to (2:3) change of the "b" to "b"
change count = 0

from (2:2) to (3:3) change of the "b" to "a"
change count = 1

from (2:2) to (3:2) change of the "b" to "b"
change count = 0

from (2:2) to (3:1) change of the "b" to "a"
change count = 1
----------------------------------------------
Total change counts = 4
==============================================

The result is a table like this

area changecounts
1      0
4      3
9      4

Anybody have any idea for solve this?

Any sugestions?

Thanks for all

Ronaldo






-- 
Before destruction a man's heart is haughty, but humility goes before honour.
		-- Psalms 18:12
--
|   // | \\   [*****************************][*******************]
|| ( õ   õ )  [Ronaldo Reis Júnior          ][PentiumIII-600     ]
|      V      [UFV/DBA-Entomologia          ][HD: 30 + 10 Gb     ]
||  /     \   [36571-000 Viçosa - MG        ][RAM: 128 Mb        ]
|  /(.''`.)\  [Fone: 31-3899-2532           ][Video: SiS620-8Mb  ]
||/(: :'  :)\ [chrysopa at insecta.ufv.br      ][Modem: Pctel-onboar]
|/ (`. `'` ) \[ICQ#: 5692561                ][Kernel: 2.4.18     ]
||  ( `-  )   [*****************************][*******************]
||| _/   \_Powered by GNU/Debian W/Sarge D+ || Lxuser#: 205366



More information about the R-help mailing list