On 8/24/2007 8:05 AM, Alberto Monteiro wrote: > Ronaldo Reis Junior wrote: >> >> It is possible to use a shell command inside a R script? >> >> I'm write a R script and I like to put somes shell commands inside >> to R. Somethink like: convert fig01.png fig01.xpm or sed ..., etc. >> >> It is possible? How? >> > ?system > > BTW, I found that using things directly in R is _much_ > slower than creating a batch file and then running it. > > For example, I had a directory with misnamed mp3 files, > and I wanted to use R to rename and copy them > to another directory. I tried to use file.copy, but it > took too much time. Writing a batch file and then running > it was much faster.
Since you say "batch file" I assume you're on Windows. If that's the case, then file.rename() can rename and move a file to a new directory, as long as it's on the same drive. That should be as quick as a batch file. Duncan Murdoch ______________________________________________ R-help@stat.math.ethz.ch 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.