Write Data to ASCII File

DESCRIPTION:
Writes the contents of the data to a file in ASCII format.

USAGE:
write(x, file="data", ncolumns=<<see below>>, append=F)

REQUIRED ARGUMENTS:
x:
vector, missing values (NAs) are allowed.

OPTIONAL ARGUMENTS:
file:
character string naming the file on which to write the data.
ncolumns:
number of data items to put on each line of file. Default is 5 per line for numeric data, 1 per line for character data.
append:
logical flag: should the data be appended to any information previously in file?

SIDE EFFECTS:
file is created or appended with the contents of data.

DETAILS:
Because of the way matrix data is stored, matrices are written in column by column order. The result is equivalent to an S-PLUS vector - the ncol argument states the user's preference and is unrelated to the dimensions of the matrix.

Missing values are written as NA, Infinities as plus or minus Inf, and "Not a Numbers" as NaN.


SEE ALSO:
dput , dump , scan , cat .

EXAMPLES:
write(round(x, 3), "filex")
amp;# write matrix row by row
write(t(x), file="x.byrows", ncol=ncol(x))