[R] Reg:K-Means cluster/Matrix Analysis

Padmanabhan Anbazhagan @b@bub|o @end|ng |rom gm@||@com
Sat May 15 03:59:35 CEST 2021


Dear All,
I have a cluster (.csv) file and need to extract the values of col1 based
on Col2 and store it. For instance, if Col2 = 1 it should store the values
Bat, Hat and Mat.  Then, the stored values have to be searched in a
similarity matrix file to get the scores and average. For example in
cluster 1, I need to get the scores between Bat-Hat, Bat-Mat, Hat-Bat,
Hat-Mat, Mat-Bat, Mat-Hat. Lastly, need to print the average score of
(Bat-Hat, Bat-Mat), (Hat-Bat, Hat-Mat), and (Mat-Bat, Mat-Hat). To do so,
any help with R script would be greatly appreciated. Many thanks in advance.

Col1Col2
Bat 1
Hat 1
Mat  1
Dog 2
Cow 2
Ant 2
Man 3
Bun 3
Pen 3

   Bat

  Hat

  Mat

   Dog

   Cow

   Ant

   Man

   Bun

   Pen

Bat

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

Hat

0.9

0

1.1

1.2

1.3

1.4

1.5

1.6

1.7

Mat

1.8

1.9

0

2.1

2.2

2.3

2.4

2.5

2.6

Dog

2.7

2.8

2.9

0

3.1

3.2

3.3

3.4

3.5

Cow

3.6

3.7

3.8

3.9

0

4.1

4.2

4.3

4.4

Ant

4.5

4.6

4.7

4.8

4.9

0

5.1

5.2

5.3

Man

5.4

5.5

5.6

5.7

5.8

5.9

0

6.1

6.2

Bun

6.3

6.4

6.5

6.6

6.7

6.8

6.9

0

7.1

Pen

7.2

7.3

7.4

7.5

7.6

7.7

7.8

7.9

0

Best regards
Padhu

	[[alternative HTML version deleted]]



More information about the R-help mailing list