Thanks, Bert write.table won't do the trick, because distance matrices in R are presented as lower triangular matrices. write.table "cannot coerce class "dist" into a data.frame".
maybe there is a way to transform the lower triangular matrix into a full matrix, and then use write.table ? cheers, Eric On Jan 19, 2006, at 1:38 PM, Berton Gunter wrote: > Just use write.table() from the base package with row.names=TRUE (the > default). > > -- Bert Gunter > Genentech Non-Clinical Statistics > South San Francisco, CA > > "The business of the statistician is to catalyze the scientific > learning > process." - George E. P. Box > > > >> -----Original Message----- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On Behalf Of Eric Pante >> Sent: Thursday, January 19, 2006 10:09 AM >> To: [email protected] >> Subject: [R] matrix export >> >> Dear listers, >> >> I need to export a distance matrix in the following format : >> >> a 0.0 1.0 0.2 1.0 1.0 >> b 1.0 0.0 1.0 1.0 1.0 >> c 0.2 1.0 0.0 1.0 1.0 >> d 1.0 1.0 1.0 0.0 1.0 >> e 1.0 1.0 1.0 1.0 0.0 >> >> I tried write.matrix() from the MASS library, which gives: >> >> a b c d e >> 0.0 1.0 0.2 1.0 1.0 >> 1.0 0.0 1.0 1.0 1.0 >> 0.2 1.0 0.0 1.0 1.0 >> 1.0 1.0 1.0 0.0 1.0 >> 1.0 1.0 1.0 1.0 0.0 >> >> Does anyone know of an R trick to change the location of the headers >> ?or do I need to do this externally, through perl or bash ? >> >> Thanks in advance for your help, >> Eric >> >> >> Eric Pante >> ---------------------------------------------------------------- >> College of Charleston, Grice Marine Laboratory >> 205 Fort Johnson Road, Charleston SC 29412 >> ---------------------------------------------------------------- >> >> "On ne force pas la curiosite, on l'eveille ..." >> Daniel Pennac >> >> ______________________________________________ >> [email protected] mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide! >> http://www.R-project.org/posting-guide.html >> > > Eric Pante ---------------------------------------------------------------- College of Charleston, Grice Marine Laboratory 205 Fort Johnson Road, Charleston SC 29412 ---------------------------------------------------------------- "On ne force pas la curiosite, on l'eveille ..." Daniel Pennac ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
