Re: [R] advice on exporting a distance matrix in the correct format needed please

From: Hans-Joerg Bibiko <bibiko_at_eva.mpg.de>
Date: Wed 16 Aug 2006 - 23:10:51 EST

In order to get a table structure out of a dist object use 'as.matrix ()' like 'as.matrix(dist(myMatrix))' and write.table().

Hans

On 16 Aug 2006, at 14:46, Ffenics wrote:

> Hi there
> Could anyone please tell me how to export a distance matrix to
> a .csv file please? when I tried write(matrix) I got the values but
> not in the format of a distance matrix - just a list of numbers in
> 4 columns - and when I try write.table(matrix, file="distance.csv")
> I get the following
> Error in as.data.frame.default(x[[i]], optional = TRUE) :
> cannot coerce class "dist" into a data.frame
> Any suggestions much appreciated
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.
>
>



R-help@stat.math.ethz.ch 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. Received on Wed Aug 16 23:15:49 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 17 Aug 2006 - 00:29:25 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.