Description Usage Arguments See Also Examples
The arguments are identical to those of
write.table
, except the defaults differ:
the separator is a tab, does not include quotation marks, and
does not use row names by default.
1 2 3 4 |
x |
The object to be written, preferably a matrix or data frame. If not, it is attempted to coerce x to a data frame. |
file |
Tither a character string naming a file or a connection open for writing. "" indicates output to the console. |
append |
Logical. Only relevant if file is a character string. If |
quote |
A logical value ( |
sep |
Separator for values. |
eol |
The character(s) to print at the end of each line (row). |
na |
The string to use for missing values in the data. |
dec |
The string to use for decimal points in numeric or complex columns: must be a single character. |
row.names |
Either a logical value indicating whether the row names of x are to be written along with x, or a character vector of row names to be written. |
col.names |
Either a logical value indicating whether the column names of x are to be written along with x, or a character vector of column names to be written. See the section on CSV files for the meaning of |
qmethod |
A character string specifying how to deal with embedded double quote characters when quoting strings. |
fileEncoding |
Character string: if non-empty declares the encoding to be used on a file (not a connection) so the character data can be re-encoded as they are written. |
1 2 3 4 5 6 7 8 9 10 | ## Not run:
## To write a CSV file for input to Excel one might use
x <- data.frame(a = I("a \" quote"), b = pi)
WriteTable(x, file = "foo.csv", sep = ",", col.names = NA,
qmethod = "double")
## and to read this file back into R one needs
read.table("foo.csv", header = TRUE, sep = ",", row.names = 1)
## NB: you do need to specify a separator if qmethod = "double".
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.