write(x, file = "data", ncolumns = <<see below>>, append = FALSE,
sep = " ")
| x | a vector. Missing values (NAs) are allowed. |
| file | a character string naming the file where you want to write the data. On Windows, if file is "clipboard" the data are written to the Windows clipboard instead of to a file. |
| ncolumns | the number of data items to put on each line of file. The default is 5 per line for numeric data, and 1 per line for character data. |
| append | a logical value. If FALSE (the default), creates the file or overwrites the contents of the specified existing file. If TRUE, appends the data to any contents extant in file. |
| sep | the separator to use between data items. The default is a space: " ". |
filex <- tempfile("filex")
x <- runif(8)
write(round(x, 3), filex)
# write matrix row by row
x.byrows <- tempfile("x.byrows")
x <- matrix(1:12,4)
write(t(x), file=x.byrows, ncolumns=ncol(x))
unlink(c(filex, x.byrows)) # clean up