search for: simplewarn

Displaying 20 results from an estimated 23 matches for "simplewarn".

2015 Sep 10
2
Using IDs to suppress specific messages and warnings
...ions 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 simpleWarning, which doesn't give you the opportunity to do special handling. tryCatch(sqrt(-1), warning = function(w) class(w)) ## [1] "simpleWarning" "warning" "condition" > Designing and implementing a condition class hierarchy to support this > is indeed th...
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) >
2020 Aug 31
1
make check fails due to NA / NaN mismatch
...quot;make check" is very irregular. I compared code before and after the split you are referring to. The test in question changed in the process: This is a snippet of "tests/d-p-q-r-tests.R" (lines 1030--1034) at revision 79079, just before the split: if(!inherits(R$warning, "simpleWarning")) cat(" .. did *NOT* give a warning! ") if(!(identical(R$value, expected))) { ## allow NA/NaN mismatch in these cases for now: if(!(dist %in% c("beta","f","t") && all(is.na(R$value)))) cat(" .. not giving expected NA/NaN'...
2015 Sep 10
2
Using IDs to suppress specific messages and warnings
...for example, https://stat.ethz.ch/pipermail/r-devel/2012-October/065089.html A better way of suppressing certain conditions would be to allow them to have an identifier. (This is how MATLAB allows control over individual conditions.) The implementation ought to be fairly simple. simpleMessage, simpleWarning, and simpleError gain an id arg, which is stored in their structure. simpleMessage <- function (message, call = NULL, id = NULL) { structure( list(message = message, call = call, id = id), class = c("simpleMessage", "message", "condition") ) } I env...
2005 Aug 22
1
Fetching Warning Messages
...n("DONE"); } catch(RSrvException e) { System.out.println("Error : " + e.getMessage()); e.printStackTrace(); } } } ---------------------------End Of RWarning.java----------------------- Output of above program is (as expected) : 2.0 simpleWarning in sqrt(-9): NaNs produced simpleWarning: data length [9] is not a sub-multiple or multiple of the number of columns [4] in matrix DONE Now my query is that if there is any way of using warnings() function in Java Program to fetch all warnings. I used it in my program but returns me NUL...
2010 Dec 05
1
How to catch both warnings and errors?
...l w$call to a string. ## based on http://tolstoy.newcastle.edu.au/R/help/04/06/0217.html ## and http://www.mail-archive.com/r-help at r-project.org/msg81380.html f <- function(x){ ## warnings w.list <- NULL # init warning w.handler <- function(w){ # warning handler warn <- simpleWarning(w$message, w$call) # build warning w.list <<- c(w.list, paste(warn, collapse = " ")) # save warning invokeRestart("muffleWarning") } ## errors e.list <- NULL # init errors e.handler <- function(e){ # error handler err <- simpleE...
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,
2009 Oct 24
2
warnings details
I am running R as an invisible subprocess in another program (RExcel). Using try I can catch errors and print the errors produced by an R statement. Is there a way to know if running a statement caused a warning message? last.warning gives me the last warning, but I do not have any indication what the statement was that caused the message. I can of course store last warning before I run a
2017 Jan 04
0
cat(s, file): infinite loop of "invalid char string in output conversion" warnings with UTF-8 encoding
...39;s memory usage, and the call can be interrupted: ^C There were 50 or more warnings (use warnings() to see the first 50) > traceback() 8: "factor" %in% attrib[["class", exact = TRUE]] 7: structure(list(message = as.character(message), call = call), class = class) 6: simpleWarning(msg, call) 5: doWithOneRestart(return(expr), restart) 4: withOneRestart(expr, restarts[[1L]]) 3: withRestarts({ .Internal(.signalCondition(simpleWarning(msg, call), msg, call)) .Internal(.dfltWarn(msg, call)) }, muffleWarning = function() NULL) 2: .signalSimpleWarning...
2014 Sep 10
1
install.packages misleads about package availability?
...quot;), - sub(" *\\(.*","", R.version.string)), - domain = NA, call. = FALSE) + txt <- ngettext(sum(miss), "package %s is not available (for %s)", + "packages %s are not available (for %s)") + msg <- simpleWarning(sprintf(txt, paste(sQuote(p0[miss]), collapse=", "), + sub(" *\\(.*","", R.version.string))) + class(msg) <- c("packageNotAvailable", class(msg)) + warning(msg) if (sum(miss) == 1L &&...
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
2008 Aug 27
1
S4 coercion
...uot;TSPostgreSQLConnection#integer" (the first of the signatures shown will be used) PostgreSQLConnection#integer dbObjectId#integer > traceback() 15: doWithOneRestart(return(expr), restart) 14: withOneRestart(expr, restarts[[1]]) 13: withRestarts({ .Internal(.signalCondition(simpleWarning(msg, call), msg, call)) .Internal(.dfltWarn(msg, call)) }, muffleWarning = function() NULL) 12: .signalSimpleWarning("Ambiguous method selection for \"coerce\", target \"TSPostgreSQLConnection#integer\" (the first of the signatures shown will be us...
2008 Jun 03
1
R-2.7.0 make check failure
...l(k)) > k <- -1:6 > cbind(k=k, choose(1/2, k), mychoose(1/2, k)) *** caught segfault *** address 0x200, cause 'memory not mapped' Traceback: 1: doWithOneRestart(return(expr), restart) 2: withOneRestart(expr, restarts[[1]]) 3: withRestarts({ .Internal(.signalCondition(simpleWarning(msg, call), msg, call)) .Internal(.dfltWarn(msg, call))}, muffleWarning = function() NULL) 4: .signalSimpleWarning("NaNs produced", quote(gamma(x + 1))) 5: factorial(k) 6: ifelse(k <= 0, (k == 0), sapply(k, function(k) prod(r:(r - k + 1)))/factorial(k))...
2015 Sep 10
0
Using IDs to suppress specific messages and warnings
...permail/r-devel/2012-October/065089.html > > A better way of suppressing certain conditions would be to allow them > to have an identifier. (This is how MATLAB allows control over > individual conditions.) > > The implementation ought to be fairly simple. > > simpleMessage, simpleWarning, and simpleError gain an id arg, which is > stored in their structure. > > simpleMessage <- function (message, call = NULL, id = NULL) > { > structure( > list(message = message, call = call, id = id), > class = c("simpleMessage", "message", &quo...
2017 Jan 02
1
utils::ls.str(): Partial argument name 'digits' to seq() (should be digits.d?)
...t;- 1 > ls.str() x : Error in str.default(o, ...) : (converted from warning) partial argument match of 'digits' to 'digits.d' > traceback() 10: doWithOneRestart(return(expr), restart) 9: withOneRestart(expr, restarts[[1L]]) 8: withRestarts({ .Internal(.signalCondition(simpleWarning(msg, call), msg, call)) .Internal(.dfltWarn(msg, call)) }, muffleWarning = function() NULL) 7: .signalSimpleWarning("partial argument match of 'digits' to 'digits.d'", quote(str.default(o, ...))) 6: str.default(o, ...) 5: str(o, ...) 4: (func...
2007 Aug 27
0
Suggestion: Add simpleExit condition
...9;foo' package.") ... } I know this can be solved by a simple if {require("foo")} { } statement, but the above is to avoid such nested code, especially in example code, cf. return() and break. Here are the details to get this working: 1. Define a new condition class similar to simpleWarning() and simpleError(): simpleExit <- function(...) { cond <- simpleCondition(...) class(cond) <- c("simpleExit", class(cond)) cond } 2. Setup a method to generate such a condition similar to warning() and stop(): exit <- function(...) { invisible(signalCondition(si...
2023 Apr 30
0
Forcing a PROTECT Bug to Occur
...gt; gctorture(TRUE) > > z() > > ?*** caught segfault *** > address 0x55a68ce57f90, cause 'memory not mapped' > > Traceback: > ?1: doWithOneRestart(return(expr), restart) > ?2: withOneRestart(expr, restarts[[1L]]) > ?3: withRestarts({ ?.Internal(.signalCondition(simpleWarning(msg, > call), msg, ? ? call)) ? ?.Internal(.dfltWarn(msg, call))}, > muffleWarning = function() NULL) > ?4: .signalSimpleWarning("your C program does not return anything!", ? > ? base::quote(z())) > ?5: .Primitive(".Call")(<pointer: 0x7f2a02572160>) &g...
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
2004 Mar 09
4
how to use conditional statements to handle exceptions?
Hello, I have a problem to handle the following statements. for(i in [1:3]) { file=paste("file", i, ".dat") bb <- read.table(file) x11() plot(bb) dev.off() } When the input .dat file is empty, the program stops running and an error message appears. Could someone tell me how to handle this exception? Thanks
2012 Jul 25
2
reshape -> reshape 2: function cast changed?
Hi, I used to use reshape and moved to reshape2 (R 2.15.1). Now I tried some of my older scripts and was surprised that my cast function wasn't working like before. What I did/want to do: 1) Melt a dataframe based on a vector specifying column names as measure.vars. Thats working so far: dfm <- melt(df, measure.vars=n, variable_name = "species", na.rm = FALSE) 2) Recast the