Write Matrix of Data to a File

DESCRIPTION:

Write a matrix or data frame to an ASCII file suitable for importing into other programs

USAGE:

write.table(data, file = "", sep = ",", append = F, quote.strings = F, 
            dimnames.write = T, na = NA, end.of.row = "\n",
            justify.format = "decimal") 

REQUIRED ARGUMENTS:

data
a matrix, data.frame, or vector of numeric or character data.

OPTIONAL ARGUMENTS:

file
character string naming the file to write to. The empty string "" means the standard output.
sep
the separator character to use between fields in the file. Remember that "\t" is the tab character.
append
if TRUE write.table will add to an existing file, otherwise it will create a new one (destroying any existing file by that name).
quote.strings
if TRUE, any strings in the data, including the row and column names, will be surrounded by double quotes. If a single character string, that character string will be placed on both sides of each string. If two character strings, they will be used to surround each string. If FALSE (the default), strings will not be quoted. (Any quotes within the strings will not be treated specially -- the onus is on the user to ensure that the quotes chosen are not in the strings also.)
dimnames.write
if TRUE the row and column names ( dimnames(data)[[1]] and dimnames(data)[[2]], respectively) will be printed along with the data, if the data has dimnames. If it is any abbreviation of "rownames" or "colnames" then just the labels mentioned will be printed.
na
the character string to use for missing values in the data.
end.of.row
the character(s) to print at the end of each row of data. By default this is a newline, "\n".
justify.format
if the data inherits from data.frame, then this argument will be used to determine how to justify numeric values in the conversion to characters performed by format. Specify "none" to avoid inserting spaces in the character value.

SIDE EFFECTS:

The file is written.

SEE ALSO:

, .

EXAMPLES:

data <- state.x77 
data[1,1] <- NA 
write.table(data[1:3,1:2], sep=";", na="") 
# Produces the following output: 
# row.names;Population;Income 
# Alabama;;3624 
# Alaska;365;6315 
# Arizona;2212;4530 
write.table(data[1:3,1:2], quote=c("\(ga", "\(aa")) 
# Produces the following output: 
# \(garow.names\(aa,\(gaPopulation\(aa,\(gaIncome\(aa 
# \(gaAlabama\(aa,NA,3624 
# \(gaAlaska\(aa,365,6315 
# \(gaArizona\(aa,2212,4530