This is my approach:

If  "cosa" is your data.frame . e.g.

 >cosa
     i1 i2  dis
  [1,]  1  1 0.00
  [2,]  1  2 0.93
  [3,]  1  3 0.80
  [4,]  1  4 1.00
  [5,]  2  2 0.00
  [6,]  2  3 0.02
  [7,]  2  4 0.22
  [8,]  3  3 0.00
  [9,]  3  4 0.95
[10,]  4  4 0.00

# first crate a square matrix of  0´s, of the 
appropriate dimensions (in this example, 4)

pepe <- matrix(0, nr=4, nc=4)

# then assign your long disimilarity data to trhe 
lower tree of the square matrix
# check the diag argument!

pepe[lower.tri(pepe, diag=T)] <- cosa[,3]

# then transpose the matrix

pepe <- t(pepe)

# and symmetrize the resulting matrix

library(calibrator)
pepe <- symmetrize(pepe)

# finaly,  transform to a dist matrix:

pepe <- as.dist (pepe)

HTH,

Marcelino




kirsten-be...@uiowa.edu wrote:

I have a dissimilarity dataset with the form:

1  1  dissimilarity value
1  2  ...
1  3
1  4
2  2
2  3
2  4
...

I would like to do nonmetric multidimensional scaling with this data, but I
am having trouble using this format.  I would like to either find a function
that accepts this format or find a way to easily convert this format to a
matrix for use with existing functions.

Thanks!




________________________________



Marcelino de la Cruz Rot



Departamento de  Biología Vegetal

E.U.T.I. Agrícola

Universidad Politécnica de Madrid

28040-Madrid

Tel.: 91 336 54 35

Fax: 91 336 56 56

marcelino.delac...@upm.es

_________________________________
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to