0
我想通過write.table
函數保存csv
格式的矩陣。使用以下命令,列名移回一個單元格。有沒有辦法保持列名完好?由於用適當的行列標題保存矩陣
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 = ","
)