I want to save a matrix in csv
format through write.table
function. Using the following command, the column names move one cell back. Is there any way to keep the column names intact? Thanks
mdat <- matrix(c(1,2,3, 11,12,13), nrow = 2, ncol = 3, byrow = TRUE,
dimnames = list(c("row1", "row2"),
c("C.1", "C.2", "C.3")))
mdat
write.table(
x=mdat
, file = "mdat.csv"
, sep = ","
)