user3005032
user3005032

Reputation: 45

Coerce association matrix from vegdist() into a dataframe

I am using the vegdist() function in the R package vegan to generate an association matrix for a species abundance dataset (the association matrix produced is 936 by 936). I want to be able to export/extract/coerce this association matrix into a dataframe or format writeable as a .csv so that I can use it for subsequent analyses. I know you can use the output from vegdist() for things like ordination after, or visualize using heat maps (coldiss()), but in this case I want to actually be able to see and manipulate the raw association matrix.

Any ideas? I wasn't sure that sample data would really help in this case since it is such a large dataset.

Upvotes: 2

Views: 3067

Answers (1)

user3006899
user3006899

Reputation: 46

Try:

write.csv(as.matrix(YOUR_MATRIX), "YOUR_MATRIX.csv")

Upvotes: 3

Related Questions