Reputation: 84529
I have written a R function which runs the lmer()
function from the lme4
package. Sometimes the lmer()
function returns some warnings, then I see these warnings when running my function.
However when running my function through an R gWidget
the warnings do not appear in the R console. They appear only after I run a new command in the R console. What should I do to see these warnings when running the widget?
I don't know whether my question is clear. My function is very long, a little complex, and takes a file as an argument. I can't copy it here and provide a reproducible example.
Upvotes: 1
Views: 91
Reputation: 121578
For some reasons I think gWidgets redirect the output.
One solution is to change the options
warn
I create a small code to generate the bug. and I confirm I have the same behaviour.
library(gWidgets)
options("guiToolkit"="RGtk2")
warn.handler <- function(h,...) { warnings('dummy warning')}
win <- gwindow("Hello World, ad nauseum", visible=TRUE)
group <- ggroup(horizontal = FALSE, container=win)
obj <- gbutton("Hello...",container=group,handler = warn.handler)
here my warn.handler function generate a dummy warning :
warn.handler()
Warning message:
In warn.handler() : dummy warning
but when I run the gwidget , and I click on the button I don't have the warnings.
when I change the options warn
options(warn=1) # print warnings as they occur
I get the warnings.
Upvotes: 1