[R] using a file name in a system call

Joshua Wiley jwiley.psych at gmail.com
Wed Nov 2 05:11:36 CET 2011


system is one option, as it turns out, this is common enough that there are special functions for it, see ?file.copy

More generally, this is a great use of apropos:

apropos("file")

Shows a lot of options.  An alternative work flow would be a shell script that runs r scripts and also interacts with the system (depending how much system interaction is needed).

Cheers,

Josh

On Nov 1, 2011, at 19:42, Erin Hodgess <erinm.hodgess at gmail.com> wrote:

> Dear R People:
> 
> I have a variable named file1 which contains the name of a file.  I
> would like to copy that file to a different directory.  Can I do that
> via the system command or is there a better way, please?
> 
> Thanks,
> Erin
> 
> 
> -- 
> Erin Hodgess
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> mailto: erinm.hodgess at gmail.com
> 
> ______________________________________________
> 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.



More information about the R-help mailing list