Skip to content

using a file name in a system call

2 messages · Erin Hodgess, Joshua Wiley

#
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
#
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: