How do you write a CSV in R with the matrix names (dimnames(M)) intact in R?
Question
Is there a command in R that will allow you to write a CSV file that has the row and column names of a matrix (dimnames(M))? Whenever I output the file, the names are gone.
help(write)
doesn't mention that this is possible to do.
Solution
Use write.csv
OTHER TIPS
Use write.table(...,row.names=TRUE,col.names=TRUE,sep=",")
Note that there is an entire manual dedicated to questions like this, it really does not hurt to look at those once in a while.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow