Displaying 20 results from an estimated 7000 matches similar to: "How to catch warnings"
2010 Nov 18
1
Why some times R-halts?
Hello everyone.
I have written a small function that returns a 3*n array where n is typicall between 5-55.
I issued in R
shweights<-shadowing_weights(x,xr)
and I got the result in less that one sec.
then I tried to see what is inside the shweights array and thus I issued the
edit(shweights) which 10 mins right now is busy and got no reply yet back.
As I am using rkward I tried from gui the
2010 Nov 18
1
why help ignores some values
Please take a look at the values below
.................
[31,] 30.000000000000000 30.000000000000000
[32,] 31.000000000000000 31.000000000000000
[33,] 32.000000000000000 32.000000000000000
[34,] 33.000000000000000 33.000000000000000
[35,] 34.000000000000000 34.000000000000000
[36,] 35.000000000000000 35.000000000000000
[37,] 35.999999999999872 35.999999999999872
These are entries in an array.
2010 Nov 17
3
Variable Editor
Hello everoyne,
If you have ever used matlab you should know the variable editor. You click over the value of a variable in the workspace and it opens like a excel sheet. Do you know if there is something like that in R . This will make easier for me to understand what values are stored in a matrix.
Also I am using rkward. Do you know if there is anyway to see the already defined variables?
I
2010 Dec 05
1
How to catch both warnings and errors?
Dear expeRts,
I am struggling with warning/error handling.
I would like to call a function which can produce either
a) normal output
b) a warning
c) an error
Since the function is called several (thousand) times in a loop, I would like
to proceed "quietly" and collect the warnings and errors [to deal with them at a
later point].
I have seen constructs with tryCatch (which can
2013 Nov 29
1
How to catch warnings sent by arguments of s4 methods ?
Hello,
I apologized if this had already been addressed, and I also submitted
this problem on SO:
http://stackoverflow.com/questions/20268021/how-to-catch-warnings-sent-during-s4-method-selection
Example code:
setGeneric('my_method', function(x) standardGeneric('my_method') )
setMethod('my_method', 'ANY', function(x) invisible())
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)
>
2006 Oct 29
3
R GUI API: suggestion for R function to put in there?
Well, following a discussion with Duncan Murdoch, where he suggests me
to rewrite my requests, here it is.
Just a couple of problems I found difficult to solve, as a writer of R
GUIs, and for which I would be very happy to get a R function (plus
rationates):
- To know if an evaluation returns invisibly or not. This is discussed
in a previous thread. We now have withVisible().
- To know if
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
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
2004 Jun 10
1
tryCatch() and preventing interrupts in 'finally'
With tryCatch() it is possible to catch interrupts with tryCatch(). Then you
can use a 'finally' statement to clean up, release resources etc. However,
how can I "protect" against additional interrupts? This is a concern when
the hold down Ctrl+C and generates a sequence of interrupts. Example:
tryCatch({
cat("Press Ctrl+C...\n");
Sys.sleep(5);
}, interrupt =
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
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
2005 Nov 23
2
TryCatch() with read.csv("http://...")
Hi, folks!
I'm trying to pull in data using read.csv("my URL goes here"), and it really
works fantastically. Amazing to pull in live data right off the internet,
into RAM, and get busy...
however...
occasionally there is a server problem, or the data are not up yet, and
instead of pushing through a nice CSV file, the server sends a 404 "Not
Found" page...
Since the
2005 Sep 07
1
Tracebacks with tryCatch() and withCallingHandlers()?
When batch processing analysis, I use tryCatch() for failure handling
and to prevent unwanted interrupts. I write detailed progress to log
file and conditions (warnings and errors) are written to the same log
file immediately by using withCallingHandlers(..., condition=function(c)
cat(c, file=logFile)). However, I would also like to write the call
stack to the log file to further simplify
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
2020 Oct 31
2
strptime() keeps emitting warnings after establishing a handler with tryCatch()
Dear list members,
I have come about a peculiar behavior in R (4.0.2) which I would
describe as a bug.
On macOS, where `strptime()` raises a warning for invalid timezone
identifiers, the following code will continue to raise the original
warning with every subsequent call to `strptime()`:
```
# attach a handler for warnings for this call only:
tryCatch(strptime('2020-10-31 18:30', format
2006 Sep 15
3
How to catch a parameter that contains a full url
Hi
I need some help!
I have controller that I need to pass a full url (with its own
parametrs) as a parameter, e.g. I want to call my controller with:
/mycontroller/catchurl?url=http://somedomain.com/afile.jsp?param1=xx¶m2=yy
and in action "catchurl" in mycontroller.rb I would like to have
params[:url] to be
"http://somedomain.com/afile.jsp?param1=xx¶m2=yy"
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
2010 Sep 23
3
accumulation curves
Hi,
I am trying to fit a logarithmic trendline to a scatterplot of a
species accumulation curve. I've tried abline, lines, curve and
scatter.smooth but none of these work.
Can anyone help please,
Kyran
2006 Aug 29
1
Capturing warnings with capture.output
Is there any way to include warnings in the output from capture.output? eg:
a <- capture.output(warning("test"))
all.equal(a, "Warning message: \n test ")
Conceptually, this seems like redirecting stderr to stdout, or somehow
changing warning to simple print it's output. I've had a look at
tryCatch and using a warning handler, but this terminates execution at
the