On Tue, 29 Jul 2008, Dennis Fisher wrote:

Colleagues,

(Running R 2.7.0)

I have a script that I want to delete as it completes execution.  The
penultimate line of the script (before the quit command) is:
        file.remove("Scriptname")
The script is executed as:
        R --no-save < Scriptname

In OS X and Linux this is successful and returns:
file.remove("x")
[1] TRUE
and the file is deleted

In Windows XP, it returns:
[1] FALSE

and the file is not deleted.

I realize that this is an OS issue rather than an issue with execution
of the command.  Is there some means to delete the script from within R?

Not in an OS that does not allow open files to be deleted. (Not the whole truth for WIndows, but true of the mechanism used to implement redirection in the compiler used for R.)

You could modify Rscript to do so (it does not use re-direction).


Dennis

Dennis Fisher MD
P < (The "P Less Than" Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-415-564-2220
www.PLessThan.com


        [[alternative HTML version deleted]]

______________________________________________
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.


--
Brian D. Ripley,                  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
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.

Reply via email to