Re: [R] Removing script file

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Tue, 29 Jul 2008 18:00:02 +0100 (BST)

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_at_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,                  ripley_at_stats.ox.ac.uk
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_at_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.
Received on Tue 29 Jul 2008 - 17:12:20 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Jul 2008 - 17:32:51 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive