Re: [R] Inheritance and automatic function call on script exit

2010-10-06 Thread Bert Gunter
1) It would be better if you understood R "scripts" as functions. R, possibly using either the proto or oo package, has at least 4 "inheritance" schemas that I know of. None will do what you want, asaik. 2. ?on.exit will tell you what you did wrong below. 3. If I understand your query correctly,

Re: [R] Inheritance and automatic function call on script exit

2010-10-06 Thread Ralf B
Here the modified script with what I learned from Joshua: # # superscript # output <- NULL writeOutput <- function() { processTime <- proc.time() outputFilename <- paste("C:/myOutput_", processTime[3], ".csv", sep="") write.csv(output, file = outputFilename) } on.exit(wr

Re: [R] Inheritance and automatic function call on script exit

2010-10-06 Thread Ralf B
I think base:on.exit() will do the trick. Thank you :) Ralf On Wed, Oct 6, 2010 at 11:24 AM, Ralf B wrote: >> If you are running these interactively, you could make your own >> source() function.  In that function you could define the super and >> subscripts, and have it call writeOutput on.exit

Re: [R] Inheritance and automatic function call on script exit

2010-10-06 Thread Ralf B
> If you are running these interactively, you could make your own > source() function.  In that function you could define the super and > subscripts, and have it call writeOutput on.exit().  I suspect you > could get something like that to work even in batch mode by having R > load the function by

Re: [R] Inheritance and automatic function call on script exit

2010-10-06 Thread Joshua Wiley
On Wed, Oct 6, 2010 at 7:59 AM, Ralf B wrote: > Hi all, > > in order to add certain standard functionality to a large set of > scripts that I maintain, I developed a superscript that I manually > include into every script at the beginning. Here an example of a very > simplified super and subscript

[R] Inheritance and automatic function call on script exit

2010-10-06 Thread Ralf B
Hi all, in order to add certain standard functionality to a large set of scripts that I maintain, I developed a superscript that I manually include into every script at the beginning. Here an example of a very simplified super and subscript. # # superscript # output <- NULL writeOutput <- funct