scicloj / clojisr

Clojure speaks statistics - a bridge between Clojure to R
https://scicloj.github.io/clojisr/
Eclipse Public License 2.0
147 stars 9 forks source link

error is thrown when calling a fn that requires user input #57

Closed ezmiller closed 3 years ago

ezmiller commented 4 years ago

When you call the tidytext function get_sentiments and you have not yet downloaded the required dataset, you get a request for user input if you are working in R:

> get_sentiments("afinn")
Do you want to download:
 Name: AFINN-111
 URL: http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6010
 License: Open Database License (ODbL) v1.0
 Size: 78 KB (cleaned 59 KB)
 Download mechanism: https

1: Yes
2: No

When you call this fn in clojisr, you get an error that doesn't really indicate what has happened. You do see the output in the console.

It would be nice to somehow allow for user input across the divide.

genmeblog commented 4 years ago

I've got the error:

R exception: Error in menu(choices = c("Yes", "No"), title = title) : 
  menu() cannot be used non-interactively
genmeblog commented 4 years ago

I don't think it is solvable. I see that there are function intended to use within interactive session (like menu, readline or select.list).

Menu help stays:

It is an error to use menu in a non-interactive session.

I think our session is not interactive (maybe there is a way to turn it on and force using GUI?)

genmeblog commented 4 years ago

More info about interactive session: https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/interactive

clojisr (in case of RServe) is non-interactive

(base/interactive) ;; => [1] FALSE
genmeblog commented 4 years ago

Also, this can be related: https://stackoverflow.com/questions/17328172/forcing-interactive-r-session but I haven't tried it yet.

genmeblog commented 3 years ago

No chance to fix it, there are functions which are supposed to be used within RStudio and require interactive session. There is no option to turn it on for RServe.