> I run the script and it exports a PDF called "version 1".
> I want it to check if "version 1" already exists. If so,
>  then I want the new graphs to be exported as
> "version 2", and so on.
>
> Is it possible to do it in R?

Someone may know a way.  However its certainly possible to execute a command in 
linus from R.  So you can ls the file (in windows try dir) and see if it 
exists, and build a loop round that.
Just bew3are it'll be quick if there is only 1 file.  If you have 9999 files it 
may slow things down a bit!
Here's my example...

#Example script to check if a file exists (linux system)
filename = "somefile"
fileno = 0
extension= ".pdf"
path="/home/user/"

repeat
{
        fullfile= paste(path,filename,fileno,extension, sep="")
        if (length (system(paste("ls",fullfile), intern = T)) == 0) break
        fileno<-fileno+1
}

#your command to save the file... using 'fullfile' as the filename and path


********************************************************************************************************************

This message may contain confidential information. If yo...{{dropped:21}}

______________________________________________
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.
  • [R] Expo... chrisli1223
    • Re:... jim holtman
      • ... chrisli1223
    • Re:... Polwart Calum (County Durham and Darlington NHS Foundation Trust)
      • ... Phil Spector

Reply via email to