search for: mufflewarning

Displaying 20 results from an estimated 22 matches for "mufflewarning".

2012 Oct 21
1
suppress *specific* warnings?
...... ?) suppressWarnings2 <- function(expr,regex=NULL) { opts <- options(warn = -1) on.exit(options(opts)) withCallingHandlers(expr, warning = function(w) { ## browser() if (is.null(regex) || grepl(w[["message"]],regex)) { invokeRestart("muffleWarning") } else { ## ? what do I here to get the warning issued? ## browser() ## computeRestarts() shows "browser", ## "muffleWarning", and "abort" ... options(opts) warning(w$message)...
2019 Feb 24
1
stopifnot
...#39;eval' is used only in handling stopifnot(exprs=) . The warning message from stopifnot(exprs={warning()}) has 'eval' call: In eval(cl.i, envir = envir) : This may work. withCallingHandlers(<something>, warning = function(w) { w$call <- cl.i; warning(w); invokeRestart("muffleWarning") }) Current documentation says: Since R version 3.5.0, expressions are evaluated sequentially, and hence evaluation stops as soon as there is a "non-TRUE", asnindicated by the above conceptual equivalence statement. Further, when such an expression signals an error or warning, its...
2010 Dec 05
1
How to catch both warnings and errors?
...lt;- 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 <- simpleError(e$message, e$call) e.list <<- c(e.list, paste(err, collapse = " ")) # save error } ## execute command res <- withCallingHandlers...
2019 Feb 27
1
stopifnot
...warning message from ? ? > stopifnot(exprs={warning()}) ? ? > has 'eval' call: ? ? > In eval(cl.i, envir = envir) : ? ? > This may work. ? ? > withCallingHandlers(<something>, ? ? > warning = function(w) { ? ? > w$call <- cl.i; warning(w); invokeRestart("muffleWarning") }) ? ? > Current documentation says: ? ? > Since R version 3.5.0, expressions are evaluated sequentially, and hence evaluation stops as soon as there is a "non-TRUE", asnindicated by the above conceptual equivalence statement. Further, when such an expression signals an err...
2012 Feb 03
1
GAM (mgcv) warning: matrix not positive definite
...Model_n_Warnings <- function(expr) { localWarnings <- list() outModel <- withCallingHandlers(expr, warning = function(w) { localWarnings[[length(localWarnings)+1]] <<- w$message # store warning message invokeRestart("muffleWarning") # avoid printing warning message to console }) list(outModel=outModel, warnings=localWarnings) } out <- Model_n_Warnings (gam(USE ~ X1 + s(X2) + s(X3), family = binomial, data = data, method="REML")) out$warnings [[1]] [1] "matrix not positive d...
2008 Aug 27
1
S4 coercion
...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 used)\n PostgreSQLConnection#integer\n dbObjectId#integer\n", quote(NULL)) 11: w...
2019 May 03
1
Strange error messages from parallel::mcparallel family under 3.6.0
...(1);TRUE}, timeout=3)) results in sporadic messages of the form: Error in mcexit(0L) : ignoring SIGPIPE signal 6: selectChildren(jobs, timeout) 5: parallel::mccollect(child, wait = FALSE, timeout = timeout) at forkTimeout.R#75 4: withCallingHandlers(expr, warning = function(w) invokeRestart("muffleWarning")) 3: suppressWarnings(parallel::mccollect(child, wait = FALSE, timeout = timeout)) at forkTimeout.R#75 2: forkTimeout({ Sys.sleep(1) ... 1: print(forkTimeout({ Sys.sleep(1) ... So, these messages do not appear to prevent the child process from returning valid output, bu...
2008 Jun 03
1
R-2.7.0 make check failure
...ht 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)) 7: mychoose(1/2, k) 8: cbind(k = k, choose(1/2, k), mychoose(1/2, k)) aborting ... I r...
2017 Jan 02
1
utils::ls.str(): Partial argument name 'digits' to seq() (should be digits.d?)
...ment 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: (function (...) str(o, ...))(max.level = 1, give.attr = FALSE, digits = 3) 3: do.call(strO, strargs...
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
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
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
2017 Jan 04
0
cat(s, file): infinite loop of "invalid char string in output conversion" warnings with UTF-8 encoding
...sage), 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("invalid char string in output conversion", quote(cat(s, file = tempfile()))) 1: cat(s, file = tempfile()) ## SOME TROUBLESHOOTING Using options(warn = 1) shows that the "invalid char string in output conversion" warning is ou...
2018 Mar 06
0
Capturing warning within user-defined function
...ning handler will append to this using '<<-' value <- withCallingHandlers(expr, warning=function(e) { .warnings <<- c(.warnings, conditionMessage(e)) invokeRestart("muffleWarning") }) structure(value, warnings=.warnings) } z <- lapply(dataList, function(data) withWarnings(coef(glm(data=data, y ~ x, family=binomial)))) z The last line produces > z $A (Intercept) x 160.80782 -45.97184 attr(,"warnings") [1...
2023 Apr 30
0
Forcing a PROTECT Bug to Occur
...57f90, 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>) > ?6: z() > > > > > On Sun, Apr 30, 2023 at 4:04?AM Tomas Kalibera > <t...
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 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,
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
2010 Jan 11
2
warning inside loop
Hi, I'm running some data simulations using (mixed effects)* regression models that show difficulty to converge. Therefore, I seek a way of capturing warnings (of false convergence) inside a loop. Inside that loop, I modify data and estimate a model. I do so many times with slightly different modifications of the data. Next, I extract some of the model parameters and store these in a matrix.
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