Ironholds/WikipediR

Return NA when Wikipedia page doesn't exist rather than throw error

Opened this issue · 0 comments

If I want to use an lapply() statement with page_content() to get content for a vector of page names, and one or more of the entries don't have a Wikipedia page, then the whole operation fails.

It would be helpful to make the function fail gracefully (e.g. return NA) rather than throwing an error.

I have tried to use purrr::safely() to get around this, but I get an error about not being able to convert a pcontent object to function. This might be a distraction, but I can provide more details if this seems like the best path forward.