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