On Tue, Apr 8, 2008 at 1:50 PM, Hans-J?rg Bibiko <bibiko at eva.mpg.de>
wrote:> Dear all,
>
> I have -hopefully- a tiny problem.
>
> I was sent a text file containing a distance matrix ? la:
>
> 1
> 2 3
> 4 5 6
>
Try this! I put your test data in "text.txt" and voila:
mat <- matrix(0, 3,3)
mat[row(mat) >= col(mat)] <- scan("test.txt")
I found this Idea after "RSiteSearch("scan triangular") led to
this
item as the very first link:
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/22369.html
PJ
--
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas