Displaying 20 results from an estimated 3000 matches similar to: "How to catch both warnings and errors?"
2012 Oct 21
1
suppress *specific* warnings?
Not desperately important, but nice to have and possibly of use to
others, is the ability to suppress specific warnings rather than
suppressing warnings indiscriminately. I often know of a specific
warning that I want to ignore (because I know that's it's a false
positive/ignorable), but the current design of suppressWarnings() forces
me to ignore *any* warnings coming from the
2015 Sep 10
2
Using IDs to suppress specific messages and warnings
The suppressMessages and suppressWarnings functions currently suppress
all the message or warnings that are generated by the input
expression.
The ability to suppress only specific messages or warnings is
sometimes useful, particularly for cases like file import where there
are lots of things that can go wrong.
Suppressing only messages that match a regular expression has rightly
been rejected
2019 Feb 27
1
stopifnot
My points:
- The 'withCallingHandlers' construct that is used in current 'stopifnot' code has no effect. Without it, the warning message is the same. The overridden warning is not raised. The original warning stays.
- Overriding call in error and warning to 'cl.i' doesn't always give better outcome. The original call may be "narrower" than 'cl.i'.
I
2019 Feb 24
1
stopifnot
>From https://github.com/HenrikBengtsson/Wishlist-for-R/issues/70 :
... and follow up note from 2018-03-15: Ouch... in R-devel, stopifnot() has become yet 4-5 times slower;
...
which is due to a complete rewrite using tryCatch() and withCallingHandlers().
>From https://stat.ethz.ch/pipermail/r-devel/2017-May/074256.html , it seems that 'tryCatch' was used to avoid the following
2012 Feb 03
1
GAM (mgcv) warning: matrix not positive definite
Dear list,
I fitted the same GAM model using directly the function gam(mgcv) ... then
as a parameter of another function that capture the warnings messages (see
below).
In the first case, there is no warning message printed, but in the last
one, the function find two warning messages stating "matrix not positive
definite"
So my question is: Do I have to worry about those warnings and
2011 Feb 18
2
How to flag those iterations which yield a warning?
Hi,
I am running a simulation study with the survival::coxph. Some of the simulations result in problematic fits due to flat partial likelihood. So, you get the warning message:
Warning message:
In fitter(X, Y, strats, offset, init, control, weights = weights, ... :
Loglik converged before variable 2 ; beta may be infinite.
How can I keep track of the simulations which yield any kind of
2009 Feb 04
2
Capturing all warnings (with messages)
Dear all,
For an open-source project that I'm working on (1), which uses R for
all its heavy lifting but includes a wrapper shell script, I was
hoping to find a way to capture all warnings (and, in fact, errors
too), and handle them in my own way. I realise I can do this for a
single expression using something like:
> f <- function(w) print(w$message)
>
2015 Sep 10
2
Using IDs to suppress specific messages and warnings
Thanks Luke,
On 10 September 2015 at 14:47, <luke-tierney at uiowa.edu> wrote:
> Conditions have classes and the condition system is designed around
> the idea that classes would be used for this sort of thing. That is
> already how tryCatch and withCallingHandlers discriminate the
> conditions to handle.
That makes sense. Though with my sqrt example, it's just a plain
2009 Mar 27
1
deleting/removing previous warning message in loop
Hello R Users,
I am having difficulty deleting the last warning message in a loop so that the only warning that is produced is that from the most recent line of code. I have tried options(warn=1), rm(last.warning), and resetting the last.warning using something like:
> warning("Resetting warning message")
This problem has been addressed in a previous listserve string,
2019 May 03
1
Strange error messages from parallel::mcparallel family under 3.6.0
Dear All,
Since upgrading to 3.6.0, I've been getting a strange error messages
from the child process when using mcparallel/mccollect. Before filing a report in the Bugzilla, I want to figure out whether I had been doing something wrong all this time and R 3.6.0 has exposed it, or whether something else is going on.
# Background #
Ultimately, what I want to do is to be able to set a time
2005 Aug 22
1
Fetching Warning Messages
Hi,
I am facing one problem of fetching R warning messages in Java Code
using Rserve. It is easier to trap R Error messages by using catching
RSrvException. I came to know one way of fetching R Warning messages, i.e.
using "withCallingHandlers", below is my Java Program, which uses
withCallingHandlers of R :
import org.rosuda.JRclient.*;
2018 Mar 06
0
Capturing warning within user-defined function
You can capture warnings by using withCallingHandlers. Here is an example,
its help file has more information.
dataList <- list(
A = data.frame(y=c(TRUE,TRUE,TRUE,FALSE,FALSE), x=1:5),
B = data.frame(y=c(TRUE,TRUE,FALSE,TRUE,FALSE), x=1:5),
C = data.frame(y=c(FALSE,FALSE,TRUE,TRUE,TRUE), x=1:5))
withWarnings <- function(expr) {
.warnings <- NULL # warning handler will
2012 Feb 03
1
Resume processing after warning handler.
Dear list!
I have a script that processes a large number of data files. When one
file fails to process correctly, I want the script to write a message
and to continue with the next file. I achieved this with tryCatch:
for (f in files)
tryCatch({heavy.lifting(f)}, error=function(e) log.error.to.file(e))
I also want to log warning messages and tried something like this:
for (f in
2015 Sep 10
0
Using IDs to suppress specific messages and warnings
Conditions have classes and the condition system is designed around
the idea that classes would be used for this sort of thing. That is
already how tryCatch and withCallingHandlers discriminate the
conditions to handle.
Designing and implementing a condition class hierarchy to support this
is indeed the hard/tedious part.
Best,
luke
On Thu, 10 Sep 2015, Richard Cotton wrote:
> The
2013 Apr 18
1
Suppress specific warnings
Hello,
is there a convenient way to suppress only *specific* warnings? (I know about ?suppressWarnings)
I depend on another package, from which I want to suppress only some warnings, but not others.
Felix
2004 Mar 11
2
No traceback available when using try(...)
Hello,
1. The Situation :
------------------------
The stack traceback is not available when error ouccured in a try(....)
-- test.R --------------------------------
f<-function(a){
return ( log(a) )
}
try(f("A"))
traceback()
-------------------------------------------
I get the following message :
> try(f("A"))
Error in log(x) : Non-numeric argument to mathematical
2008 Aug 27
1
S4 coercion
I am extending a DBI connection by
setClass("TSPostgreSQLConnection",
contains=c("PostgreSQLConnection","TSdbOptions"))
but the first time I use this I am getting a warning when it tries to
coerce the TSPostgreSQLConnection to a PostgreSQLConnection. After the
first use the warning stops, but the first warning is causing me
problems when I do automatic checks
2008 Jun 03
1
R-2.7.0 make check failure
Hello,
I am fairly new to using R and am trying to install it on my Linux
machine, running Scientific Linux. I get through running 'configure'
and 'make' OK, but when I run 'make check', I get the following error:
make check
make[1]: Entering directory `/home/gruchti/Programs/R-2.7.0/tests'
make[2]: Entering directory `/home/gruchti/Programs/R-2.7.0/tests'
2006 Jun 25
1
using withCallingHandlers, how to deal with warning( , immediate. = TRUE)?
Hello,
I want to use withCallingHandlers(expr, warning = function(w) { ....}),
that is, to use a custom warning handler. I want this handler to
replicate the behavior of the usual handler. I have problems with the
mode 'options(warn = 0)' where the warnings are delayed, except if
calling 'warning("message", immediate. = TRUE). Indeed, if my custom
warning handler
2012 Feb 07
1
lme, lmer, convergence
Hello, all,
I am running some simulations to estimate power for a complicated epidemiological study, and am using lme and lmer to get these estimates. I have to run a few thousand iterations, and once in a great while, an iteration will create fake data such that the model won't converge. I see from Google searches that this is not an uncommon situation.
My question: is there a way to