View source: R/connection-config.R
set_bounds_check | R Documentation |
For this connection, set the response when values do not fit into given type before writing.
set_bounds_check(con, bounds_check = "error")
con |
Connection object or raw vector. Connection objects can be
created with |
bounds_check |
Default bounds checking behaviour. One of: 'ignore', 'warn', 'error'.
Default: 'error'.
This default may be over-ridden by specifying
the
|
Modified connection object
Other connection configuration functions:
set_endian()
,
set_eof_check()
,
set_integer_promotion()
,
set_na_check()
# Open a connection and configure it so out-of-bounds values
# will cause a warning only.
con <- rawConnection(as.raw(1:8), "rb")
con <- set_bounds_check(con, bounds_check = "warn")
# This line attempts to read a value from the connection which
# is too large to store in a double precision floating point without
# loss of integer precision.
# Usually this would cause an error to be raised, but the 'bounds_check'
# option has been set to give a warning only.
read_uint64(con, n = 1, promote = "dbl")
close(con)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.