Closed stevecondylios closed 2 years ago
Strong agree on the NA. If we want to pass a vector of words through define(), the error stops it in its tracks. This forces the user to write a loop that handles errors.
Thanks again for your feedback @AlunHewinson
As at a652f41b63873439e6ba95132b8f0a48bfcac6de, define()
now returns a 0 row tibble when a word is not found, such that any mapping functions which rbind the results will function seamlessly when iterating over a vector of word inputs and one or more are not found.
For example this
words <- c("paint", "sldkfjlsdjkf")
purrr::map_df(words, ~ define(.x))
will now succeed despite "sldkfjlsdjkf" not being an English word.
Consider whether
define()
should return NA or error when a word is unavailable. Current behaviour is for it to error, which may somewhat complicate use with multiple terms.