Thats a bit tricky because its hard to know how to undo all the things you might have done that need undoing. With an RDBMS, the TRANSACTION START puts a little marker in the DB file, and then if anything fails it knows where to go back to, until the COMMIT comes and then everything changed from the TRANSACTION START to the COMMIT are written in stone (this explanation massively simplified).
Thats a bit tricky because its hard to know how to undo all the things you might have done that need undoing. With an RDBMS, the TRANSACTION START puts a little marker in the DB file, and then if anything fails it knows where to go back to, until the COMMIT comes and then everything changed from the TRANSACTION START to the COMMIT are written in stone (this explanation massively simplified). The only thing I can think to help you is the "try" functions, which will catch errors.It'll then be your code's job to work out how much it managed to do and how to undo it before proceeding.
If you put things in functions it's possible to use this kind of pattern: updatefoo = function(foo){ try(foo2=something(foo)); if the try failed: return(foo) else: return(foo2) } yeah thats not even R syntax but you should get the picture and then you do: foo = updatefoo(foo) and you can be sure that foo won't change if something goes wrong in updatefoo....
Thanks for taking the time. Using try/tryCatch and keeping some sorts of "undo if something fails" list was also the first thing I thought of and it's probably the only feasible way at all. Just like the transaction paradigm of RDBMS a lot and wondered if someone thought about transferring that in some more elaborated way.
– songpants Oct 27 at 18:03 Its a question of what exactly you are 'committing' in R? Unlike an RDBMS where pretty much every change happens globally (in the database) very little in R happens globally, its all assignment of functions. If you write a function that detects a condition where in an RDBMS you'd do a ROLLBACK, in R you just return from that function with an error indicator or some default value.
– Spacedman Oct 28 at 8:10 True. Thus I'd need to have some sort of global registry environment that's expecting entries with structure 'id' (a unique identifier), 'commit' (the result of some local function's work) and 'rollback' (a function that will undo the commit). When some subroutine in my wrapper function fails, I'd simply find all commited changes by a lookup in that environment and execute their associated rollback-functions.
But then again that's way too complicated ;-) – songpants Oct 28 at 8:46.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.