Convert values to the given type and write to a connection
write_f64(con, x, endian = NULL, bounds_check = NULL, na_check = NULL)write_dbl(con, x, endian = NULL, bounds_check = NULL, na_check = NULL)
write_f32(con, x, endian = NULL, bounds_check = NULL, na_check = NULL)
write_single(con, x, endian = NULL, bounds_check = NULL, na_check = NULL)
write_f16(con, x, endian = NULL, bounds_check = NULL, na_check = NULL)
write_half(con, x, endian = NULL, bounds_check = NULL, na_check = NULL)
If con
is a connection then this connection is returned invisibly.
If con
is a raw vector then new data is appended to this vector
Connection object or raw vector. When con is a raw vector, new
data will be appended to the vector and returned.
Connection objects can be
created with file()
, url()
,
rawConnection()
or any of the other many connection creation
functions.
vector to write
Ordering of bytes within the file when reading multi-byte values.
Possible values: 'big' or 'little'.
Default: NULL indicates that
endian option should be retrieved from the connection object if possible
(where the user has used set_endian()
) or otherwise
will be set to "little"
Check values lie within bounds of the given type.
Default: NULL indicates that
this option should be retrieved from the connection object if possible
(where the user has used set_bounds_check()
) or otherwise
will be set to "error"
Check for NAs in the data to be written.
Default: NULL indicates that
this option should be retrieved from the connection object if possible
(where the user has used set_na_check()
) or otherwise
will be set to "error"
Other data output functions:
fprintf()
,
write_hex()
,
write_raw()
,
write_uint8()
,
write_utf8()
con <- file(tempfile(), "wb")
write_f64(con, c(1, 2, 3, 4))
close(con)
Run the code above in your browser using DataLab