# Most of the time, `maybe_lossy_cast()` returns its input normally:
maybe_lossy_cast(
c("foo", "bar"),
NA,
"",
lossy = c(FALSE, FALSE),
x_arg = "",
to_arg = ""
)
# If `lossy` has any `TRUE`, an error is thrown:
try(maybe_lossy_cast(
c("foo", "bar"),
NA,
"",
lossy = c(FALSE, TRUE),
x_arg = "",
to_arg = ""
))
# Unless lossy casts are allowed:
allow_lossy_cast(
maybe_lossy_cast(
c("foo", "bar"),
NA,
"",
lossy = c(FALSE, TRUE),
x_arg = "",
to_arg = ""
)
)
Run the code above in your browser using DataLab