[R] Read a similarity matrix from excel

George Kakarontzas gkakaron at yahoo.gr
Tue Feb 1 10:20:48 CET 2011


Good morning,

I have an excel spreadsheet with similarities among objects. The format of
the file is the following:

1st row: <empty cell>,<object-1-name>,<object-name-2>,...,<object-N>
2nd row: <object-name-1>,0,s<1,2>,s<1,3>,...,s<1,N>
3rd row: <object-name-2>,s<2,1>,0,s<2,3>,...,s<2,N>

The table is symmetrical and contains the similarities among the objects
(s<x,k> stands for similarity among x and k). The first row contains the
name of the objects (strings of characters) in the same order that these
same names are contained in the first column. The cell <1,1> is empty.

How can I read this in R so that after reading it I can perform a
hierarchical clustering. The table is 78x78 so it is relatively easy to
manually change something if it makes it easier to read.

I found many articles about reading a data table with variables and then
constructing the distance matrix from within R, but I have the similarity
matrix instead. 

Thank you for your help

George



More information about the R-help mailing list