I have a dataframe like this (toy example): x y z "a" "a" 0 "a" "b" 1 "a" "c" 2 "b" "a" .9 "b" "b" 0 "b" "c" 1.3 "c" "a" 2.2 "c" "b" 1.1 "c" "c" 0
The observations are from a matrix like this: c 2.2 1.1 0.0 b 0.9 0.0 1.3 a 0.0 1.0 2.0 a b c Notice that the observation a,b != b,a That is because the two stimuli a & b are presented to the subject, who judges how different they are. The stimuli are presented twice, once in the order a,b and once in the order b,a. Subjects are not perfectly consistent and so will not give exactly the same answer twice. However it is reasonable to take the average of a,b and b,a. I would like to do cmdscale or isoMDS on the data. As I understand it, these take the data as a lower triangle. At least that is how the eurodist example for cmdscale went. So in my case I need c b 1.20 a 0.95 2.10 a b c Starting from the dataframe at the top of this posting, how do I get a lower triangular matrix in this form, with the labels a, b, c (just like eurodist)? Thanks very much for any help. Bill ______________________________________________ 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.