[Rd] Resume processing after warning handler.

2012-02-04 Thread Titus von der Malsburg
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.err

Re: [Rd] Resume processing after warning handler.

2012-02-06 Thread Titus von der Malsburg
On Sat, Feb 4, 2012 at 4:37 PM, Martin Morgan wrote: > On 02/03/2012 02:49 AM, Titus von der Malsburg wrote: > Hi Titus -- use withCallingHandlers to capture the warning, and > invokeRestart() to continue after handling it. > > withCallingHandlers({ >    warning('oops

[Rd] Creating XML document extremely slow

2012-02-10 Thread Titus von der Malsburg
Hi list, I'm using the package XML to create a simple XML document. Unfortunately constructing the XML tree is extremely slow. My code (see below) adds only about 100 nodes per second on an Intel i5 machine. There's clearly something wrong but I don't see what. Here's a sample of the XML docume

Re: [Rd] Creating XML document extremely slow

2012-02-10 Thread Titus von der Malsburg
On Fri, Feb 10, 2012 at 1:40 PM, Friedrich Leisch wrote: > Have you considered simply writing the XML using standard functions > like cat() and friends? That can be much faster than creating an XML > object and writing that out (have just done that to write exams into > our e-learning platform via

Re: [Rd] Creating XML document extremely slow

2012-02-10 Thread Titus von der Malsburg
On Fri, Feb 10, 2012 at 2:10 PM, Milan Bouchet-Valat wrote: > Le vendredi 10 février 2012 à 13:18 +0100, Titus von der Malsburg a > écrit : > Just a guess, but I'd try creating all 'Marker' nodes first, storing > them in a 'markers' list, and then calling a

Re: [Rd] Creating XML document extremely slow

2012-02-10 Thread Titus von der Malsburg
On Fri, Feb 10, 2012 at 6:43 PM, Milan Bouchet-Valat wrote: > Doesn't sound so bad to me. I don't think you'll find a use case where > 3s will really be a problem. Actually I have exactly such a case because I have to produce many such documents and a difference of two orders of magnitude in proc