[R] Is it possible to detect whether running as Rscript?

2009-11-10 Thread Peter Meilstrup
I would like to write a block of code that runs when a script is being run from Rscript, but not to run if the same file is being source()d, or submitted via ESS, etc. As a gloss I would like to write a file that looks somewhat like: #!/usr/bin/env Rscript my.func - function(...) {

Re: [R] Is it possible to detect whether running as Rscript?

2009-11-10 Thread Duncan Murdoch
Peter Meilstrup wrote: I would like to write a block of code that runs when a script is being run from Rscript, but not to run if the same file is being source()d, or submitted via ESS, etc. As a gloss I would like to write a file that looks somewhat like: #!/usr/bin/env Rscript my.func