[R] [OOPS] Re: hi... problems about adjacency matrix

(Ted Harding) Ted.Harding at manchester.ac.uk
Thu Jul 8 15:31:32 CEST 2010


See at end ...

On 08-Jul-10 12:41:03, Ted Harding wrote:
> On 08-Jul-10 10:33:56, Gina Liao wrote:
>> Dear all,
>> Hi, I have the problems about converting the matrix to adjacency
>> matrix.Here's my example,
>>           a            b               c                d             
>> e               fa 1.0000000 0.4048823682 0.1228531 0.49046991
>> 0.4945158868 0.307443317b 0.4048824 1.0000000000 0.4367475 0.96949219
>> 0.0007378596 0.560747765c 0.1228531 0.4367474719 1.0000000 0.40037341
>> 0.3157538204 0.428183667d 0.4904699 0.9694921891 0.4003734 1.00000000
>> 0.0661313658 0.575606129e 0.4945159 0.0007378596 0.3157538 0.06613137
>> 1.0000000000 0.001076251f 0.3074433 0.5607477645 0.4281837 0.57560613
>> 0.0010762514 1.000000000
>> and my threshold value is 0.4763, which means any value above it is
>> "1"
>> and any values below it is "0".
>> so my adjacency matrix should be like this,
>>      a   b   c   d   e   fa   1   0   0   1   1   0b   0   1   0   1  
>> 0   1c   0   0   1   0   0   0d   1   1   0   1   0   1e   1   0   0  
>> 0   1   0f    0   1   0   1   0   1
>> 
>> I'd like to ask how to convert the matrix to adjacency matrix.
>> Thanks!!!
>> 
>> Gina
> 
> If B is your original matrix of numbers, and A is to be the adjacency
> matrix which you want, then:
> 
>   B <- 1*(A > 0.4763)
> 
> Ted.

OOPS! I got that the wrong way round! It should of course have been

  A <- 1*(B > 0.4763)

Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 08-Jul-10                                       Time: 14:31:30
------------------------------ XFMail ------------------------------



More information about the R-help mailing list