search for: withrestart

Displaying 19 results from an estimated 19 matches for "withrestart".

Did you mean: withrestarts
2012 Jan 11
0
Problem concerning withRestarts and R2WinBUGS
Dear R-users, I have a question regarding the withRestarts function in R. I´m running a simulation code in which I analyse data using both lme and R2WinBUGS. Now, I want to run this code for 1000 replications, however the model I´m using is a little ´sensitive´, so sometimes the WinBUGS analysis crashes. In that case I want the code to ignore the current...
2004 Mar 11
2
No traceback available when using try(...)
...raceback just after the try(....), and get the error message (geterrmessage()). 3. Question ------------------- A) stack traceback is not available when error ouccured in a try is a normal behavior ? B) Do you have any sugestion to fill my goal ? C) If not is it a good idea to investigate around withRestarts(expr, ...) ? Best regards PS : My R Version 1.8.1 (2003-11-21) -- Edouard Duchesnay Tel: +33 1 69 86 78 52 CEA - SHFJ Fax: +33 1 69 86 77 86 4, place du G?n?ral Leclerc 91401 Orsay Cedex France
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
2007 Feb 19
2
"try"ing to understand condition handling
...by the page documenting tryCatch and friends. I think it describes 3 separate mechanisms: tryCatch (in which control returns to the invoking tryCatch), withCallHandlers (in which control goes up to the calling handler/s but then continues from the point at which signalCondition() was invoked), and withRestarts (I can't tell where control ends up). For tryCatch the docs say the arguments ... provide handlers, and that these are matched to the condition. It appears that matching works by providing entries in ... as named arguments, and the handler matches if the name is one of the classes of the con...
2012 Sep 11
1
Is invokeRestart("abort") unstoppable?
...ary to stop(), effectively non-working with abort() calls. In order to achieve this, I stumbled upon invokeRestart("abort"), cf. help("invokeRestart", package="base") that reads "Restarts are used for establishing recovery protocols. They can be established using withRestarts. One pre-established restart is an abort restart that represents a jump to top level.". So, my current implementation is (roughly): abort <- function(...) { # handling messages etc # Fully abort the R evaluation and return to the top level invokeRestart("abort") } I've...
2010 Aug 27
1
introspective capabilities
...se the value bound to a particular name?" The context for these questions, in case anyone is interested, is that I am usually a Common Lisp programmer, and my programming environment for that (SLIME) is what I'm used to. R is sufficiently close to CL (the discovery of withCallingHandlers/withRestarts was a pleasant surprise) that I decided to experiment with implementing a SLIME backend for R -- and enough of it seems to work that I'm motivated to make it more complete. (The current state of the project is summarised at <http://common-lisp.net/~crhodes/swankr/>). Thanks, Christoph...
2010 May 05
1
help with restart
...he optimal time span between two retrieval. When the sever does not response to readLines, it will return an error and stop. What I want to do is: when an error occurs, I put R to sleep for say 60 seconds, and redo the readLines on the same link. I did some search and guess withCallingHandlers and withRestarts will do the trick. Yet, I didn't find much example on the usage of them. Can you give me some suggestions? Thanks. -- Wincent Rong-gui HUANG Doctoral Candidate Dept of Public and Social Administration City University of Hong Kong http://asrr.r-forge.r-project.org/rghuang.html
2008 Aug 27
1
S4 coercion
...thod selection for "coerce", target "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\&quot...
2008 Jun 03
1
R-2.7.0 make check failure
...ly(k, function(k) prod(r:(r-k+1))) / factorial(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)...
2023 Feb 19
2
R: determine if `suppressMessages()` has been invoked
...uot;muffleMessage" restart provided by message() itself above. We can use the fact that the availability of the "muffleMessage" restart is a documented detail and check whether signalling a "message" condition will call this restart: are_messages_suppressed <- function() withRestarts( { signalCondition(simpleMessage('')) # we stay here if restart is not invoked FALSE }, muffleMessage = function() # we jump here if restart is invoked TRUE ) are_messages_suppressed() # [1] FALSE suppressMessages(are_messages_suppressed()) # [1] TRUE I don't think I understand handler...
2017 Jan 02
1
utils::ls.str(): Partial argument name 'digits' to seq() (should be digits.d?)
...(warnPartialMatchArgs = TRUE, warn = 2) > x <- 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, ...))...
2023 Feb 19
1
R: determine if `suppressMessages()` has been invoked
Hi all, I would like to create a function that detects if suppressMessages has been invoked upon running that same function. I was looking through {https://cran.r-project.org/doc/manuals/r-release/R-ints.html}, but I haven't found an answer. I do not understand **how** suppressMessages works. I have not received an answer on SO
2009 Apr 14
0
top level condition handlers
Hello, I would like to establish top level condition handlers and restarts, so that I don't explicit calls to withCallingHandlers and withRestarts in many places: For example : > customError function( message ){ err <- simpleError( message ) class( err ) <- c( "customError", class( err) ) err } > withCallingHandlers( { signalCondition(customError( "ouch")) } , customError = function(e) cat( "...
2017 Jan 04
0
cat(s, file): infinite loop of "invalid char string in output conversion" warnings with UTF-8 encoding
...he 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("invalid char string in output conversion", quote(cat(s, file = tempfile()))) 1: cat(s, file =...
2023 Apr 30
0
Forcing a PROTECT Bug to Occur
...C program does not return anything! > > 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&...
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
2009 Mar 18
2
Profiling question: string formatting extremely slow
Hi all, I'm using R to find duplicates in a set of 6 files containing Part Number information. Before applying the intersect method to identify the duplicates I need to normalize the P/Ns. Converting the P/N to uppercase if alphanumerical and applying an 18 char long zero padding if numerical. When I apply the pn_formatting function (see code below) to "Part Number" column of the
2016 Jan 03
4
R, AIX 64-bit builds - trying to understand root cause for message: "Error: Line starting 'Package: tools ...' is malformed!"
On 2016-01-01 23:48, peter dalgaard wrote: > Nice catch you two!!! > > Happy New Year > -pd I am much happier with this great start! Simon - which compiler)s) did you use: xlc and xlfortran, or gcc/gfortran? I have made some changes to configure(.ac) so maybe my problems are self-inflicted. But would be good to know what environment you are using. Thanks for looking - and
2010 May 05
0
R-help Digest, Vol 87, Issue 5
...he optimal time span between two retrieval. When the sever does not response to readLines, it will return an error and stop. What I want to do is: when an error occurs, I put R to sleep for say 60 seconds, and redo the readLines on the same link. I did some search and guess withCallingHandlers and withRestarts will do the trick. Yet, I didn't find much example on the usage of them. Can you give me some suggestions? Thanks. -- Wincent Rong-gui HUANG Doctoral Candidate Dept of Public and Social Administration City University of Hong Kong http://asrr.r-forge.r-project.org/rghuang.html ------------...