我有一个矩阵,我想在2行文字下面写。
line #1 is here
line #2 is here
Table
我可以轻松地编写表格但是有没有办法在它上面添加文本行?
table = matrix(1:9, nrow = 3, ncol = 3)
write.table(table, "data.txt", sep="\t")
答案 0 :(得分:1)
找到了解决方案!
a = matrix(1:9, nrow = 3, ncol = 3, dimnames = list(LETTERS[1:3], LETTERS[1:3]))
cat("World \n",file="a.csv")
write.table(a, 'a.csv',sep=",",append=TRUE, col.names=NA)