write.table(x, file = "", append = FALSE, quote = TRUE, sep = " ", eol = "\n", na = "NA", dec = ".", row.names = TRUE, col.names = TRUE, qmethod = c("escape", "double"), fileEncoding = "") write.csv(x, file = "", append = FALSE, quote = TRUE, sep = " ", eol = "\n", na = "NA", dec = ".", row.names = TRUE, col.names = TRUE, qmethod = c("escape", "double"), fileEncoding = "") write.csv2(...)
Let's see a matrix example (we will print to the screen, you may give a file name for writing to the file):
> x <- matrix(c(3,5,7,1,9,4),nrow=3,ncol=2,byrow=TRUE) > write.table(x,"")
"V1" "V2" "1" 3 5 "2" 7 1 "3" 9 4
Let's write into a file and use "," as field separator:
> write.table(x,"test.csv",sep=",")
The content of "test.csv" is:
"V1","V2" "1",3,5 "2",7,1 "3",9,4