TITLE(write @@ Write data to a file)
USAGE(
write(x, file="data",
        ncolumns=if(is.character(x)) 1 else 5,
        append=FALSE)
)
ALIAS(write)
ARGUMENTS(
ARG(x @@ the data to be written out.)
ARG(file @@ the name of the file (quoted) to write to.)
ARG(ncolumns @@ the number of columns to write the data in.)
ARG(append @@ if LANG(TRUE) the data LANG(x) is appended to file LANG(file).)
)
DESCRIPTION(
The data (usually a matrix) LANG(x) are written to file LANG(file).
If LANG(x) is a two dimensional matrix you need to transpose it to get the
columns in LANG(file) the same as those in the internal representation.
)
SEEALSO(
LANG(LINK(scan)) for reading data.
)
EXAMPLES(
# create a 2 by 5 matrix
x <- matrix(1:10,ncol=5)
BLANK
# the file data contains x, two rows, five cols
# 1 3 5 6 9 will form the first row
write(t(x))
BLANK
# the file data now contains the data in x,
# two rows, five cols but the first row is 1 2 3 4 5
write(x)
)
