On Tue, Apr 8, 2008 at 1:50 PM, Hans-Jörg Bibiko <[EMAIL PROTECTED]> 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

______________________________________________
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