if (FALSE) { # interactive()
# 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)
}
Run the code above in your browser using DataLab