View source: R/connection-config.R
set_na_check | R Documentation |
For the majority of binary file formats, there is never the need to
store or retrieve an NA
value. The default behaviour of this
package is to raise an error if any attempt is made to write an NA
to file. Set this option to "warn"
or "ignore"
to modify this.
set_na_check(con, na_check)
con |
Connection object or raw vector. Connection objects can be
created with |
na_check |
Default NA 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_bounds_check()
,
set_endian()
,
set_eof_check()
,
set_integer_promotion()
# Open a connection and configure it so any attempt to write an NA
# value will cause a warning only (the default behaviour is to raise an error)
con <- rawConnection(raw(), "wb")
con <- set_na_check(con, na_check = "warn")
# This write should work without issues
write_dbl(con, c(1, 2, 3, 4))
# This write will cause a warning
write_dbl(con, c(1, 2, 3, NA))
close(con)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.