View source: R/connection-config.R
set_endian | R Documentation |
Tag a connection with the preferred endianness
set_endian(con, endian = "little")
con |
Connection object or raw vector. Connection objects can be
created with |
endian |
Default endianness to assign to this connection. One of either
"little" or "big". Default: "little".
This default may be over-ridden by specifying
the |
Modified connection object
Other connection configuration functions:
set_bounds_check()
,
set_eof_check()
,
set_integer_promotion()
,
set_na_check()
# Open a connection and configure it so all subsequent read/write operations
# use big-endian ordering.
con <- rawConnection(as.raw(c(0, 1, 0, 1)), "rb")
con <- set_endian(con, endian = "big")
# Future reads will be be big endian
read_uint16(con, n = 1)
# Unless over-ridden during the read
read_uint16(con, n = 1, endian = "little")
close(con)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.