Is there a command in R that will allow you to write a CSV file with the matrix row and column names (dimnames (M))? Whenever I output the file, the names disappear.
does not mention that it is possible.
Use write.table (..., row.names = TRUE, col.names = TRUE, sep = ",")
Note that there is a complete guide out there dealing with such issues, it really doesn't hurt to look at it from time to time.