mlr-org / bbotk

Black-box optimization framework for R.
https://bbotk.mlr-org.com
GNU Lesser General Public License v3.0
21 stars 9 forks source link

logging in Rmd interactive: Rstudio seems to catch every print() of a data.table #124

Closed jakob-r closed 3 months ago

jakob-r commented 3 years ago

... and puts it as some weird output under a chunk in the default settings.

R Console has incomplete output: image

Output is shown in extra items: image

Origin: https://github.com/mlr-org/bbotk/blob/a892bae70f31098f706afc33828c869f3efa1905/R/OptimInstance.R#L151-L153

This is no bug of bbotk but apparently RStudio crashes if a chunk generates many data table outputs.

It looks like the following is not getting caught:

x = capture.output(data.table:::print.data.table(data.table(1,2), class = FALSE, row.names = FALSE, print.keys = FALSE))
print(x)

as well as

x = capture.output(print.data.frame(data.table(1,2), class = FALSE, row.names = FALSE, print.keys = FALSE))
print(x)
jakob-r commented 3 years ago

Let's see what if the RStudio issue has an effect: https://github.com/rstudio/rstudio/issues/8732

be-marc commented 3 months ago

Quarto shows the same behavior. We can't fix this. Use lgr::get_logger("bbotk")$set_threshold(0) to avoid.