bbotk icon indicating copy to clipboard operation
bbotk copied to clipboard

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

Open jakob-r opened this issue 4 years ago • 1 comments

... 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 avatar Jan 13 '21 09:01 jakob-r

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

jakob-r avatar Jan 13 '21 10:01 jakob-r

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

be-marc avatar Aug 12 '24 15:08 be-marc