library(tibble)
training_df <- tibble(x = as.Date("2021-01-01") + 0:9,
y = LETTERS[1:10], z = letters[11:20])
training_df
prototype <- vctrs::vec_slice(training_df, 0)
vetiver_type_convert(tibble(x = "2021-02-01", y = "J", z = "k"), prototype)
## unsuccessful conversion generates an error:
try(vetiver_type_convert(tibble(x = "potato", y = "J", z = "k"), prototype))
## error for missing column:
try(vetiver_type_convert(tibble(x = "potato", y = "J"), prototype))
Run the code above in your browser using DataLab