EmilHvitfeldt / textdata

Download, parse, store, and load text datasets instead of storing it in packages
https://emilhvitfeldt.github.io/textdata/
Other
75 stars 13 forks source link

Add non-interactive option #33

Closed Ocete closed 4 years ago

Ocete commented 4 years ago

Hi! Thanks for your hard work on this repo :) I've been using it for an analysis lately and I run into a problem.

My goal was to deploy a Shiny App that uses the NRC dataset. The app would work locally but it wouldn't when I deployed it. This is because every time I tried to run get_sentiments("nrc"), a menu is used asking whether I wanted to download the dataset. This is shown in the demo: https://github.com/EmilHvitfeldt/textdata/blob/master/man/figures/textdata_demo.gif

I would suggest to add a parameter so the answer to that menu is automatically "Yes", and it downloads whatever it needs without asking.

I managed to finish my app by using the dataset locally so no rush for me, but I think I would be a nice addition. Tell me what you think :)

EmilHvitfeldt commented 4 years ago

Hello @Ocete!

It is a conscious decision not to have an argument to turn off the prompt and it will not change.

If you want to continue using textdata then you can download the data outside of R and let textdata point to it correctly https://github.com/EmilHvitfeldt/textdata/issues/28.

Ocete commented 4 years ago

Thanks for your answer! May I ask why?

EmilHvitfeldt commented 4 years ago

Sure thing!

For some of the datasets in this package, we got permission from the authors to have them accessible. One of the conditions was that the prompt appeared forcing the user to accept conditions for the data. (doing it this way also helps with CRAN licenses issues)

We can see how this promise is broken if we allow an argument to answer the prompt. Suppose we called this argument yes then another package to depend on textdata and create a function like get_afinn(). This function to be identical to lexicon_afinn() but without the prompt.

get_afinn <- function(...) {
  lexicon_afinn(..., yes = TRUE)
}
Ocete commented 4 years ago

That makes total sense, thank you very much :)