esquisse icon indicating copy to clipboard operation
esquisse copied to clipboard

Running `esquisser(my_data)` in an R Notebook (with inline output) works, but shows traceback errors.

Open orgadish opened this issue 3 years ago • 1 comments

RStudio 2021.09.2 Build 382 R 4.1.2 esquisse 1.1.0

To reproduce:

  1. Start a new R notebook from RStudio.
  2. In any chunk run esquisse::esquisser(cars).
  3. Create a figure (e.g. speed in x and dist in y)
  4. Exit the GUI.

The chunk output shows the following:

Listening on http://127.0.0.1:7454

Error in get(GeomFun, envir = pkg_envir) : 
object 'GeomHistogram' not found

Error in get(GeomFun, envir = pkg_envir) : 
object 'GeomHistogram' not found

(Yes, it shows the error twice.)

I know this "bug" may be more about how RStudio is handling the output than esquisse directly, but in an issue handling readr behavior in notebook chunks, the solution was to add a check for the notebook environment (https://github.com/tidyverse/readr/issues/793), e.g. below. Not sure if this can be applied in this case.

!isTRUE(getOption("rstudio.notebook.executing")) && # Not running in an RStudio notebook chunk
!isTRUE(getOption("knitr.in.progress")) # Not actively knitting a document

orgadish avatar Feb 28 '22 08:02 orgadish

Having esquisse::esquisser(cars) in a chunk also seems to hang the knitting process. For now my recommendation to my students is to run the esquisse GUI via the Add-in or the console and leave it out of the notebook.

orgadish avatar Feb 28 '22 08:02 orgadish