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, I don't think there's any way do exactly what you want, but ?addTaskCallback may be relevant. -- Bert On Wed, Oct 6, 2010 at 8:31 AM, Ralf B <ralf.bie...@gmail.com> wrote: > 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(writeOutput, add=T) > > > # > # subscript > # > > source("C:/superscript.R") > output <- data.frame(a=c(1,2,3), b=c(4,5,6)) > > For some reason, the file is not created. So it seems not to do the > call. What do I do wrong? > > Ralf > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Bert Gunter Genentech Nonclinical Biostatistics ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.