Examples for 'base::write'


Write Data to a File

Aliases: write

Keywords: file connection

### ** Examples

# create a 2 by 5 matrix
x <- matrix(1:10, ncol = 5)

fil <- tempfile("data")
# the file data contains x, two rows, five cols
# 1 3 5 7 9 will form the first row
write(t(x), fil)
if(interactive()) file.show(fil)
unlink(fil) # tidy up

# Writing to the "console" 'tab-delimited'
# two rows, five cols but the first row is 1 2 3 4 5
write(x, "", sep = "\t")
1	2	3	4	5
6	7	8	9	10

[Package base version 4.2.3 Index]