I think what you want is something like this

 system(sprintf('C:/Users/.../dssp-2.0.4-win32.exe -i data%d.txt -o
data%d.dssp', i, i))

On Fri, Feb 15, 2013 at 12:33 PM, Esam Tolba <eato...@gmail.com> wrote:
> hi all
> I am using r (2.15.2) in windows 7 32bit
> I want to execute an external program from r console. the program is a
> command line program which needs the following format to start
>                                   C:/Users/.../dssp-2.0.4-win32.exe -i
> data_1.txt -o data_1.dssp
> I used the system command as:
>                                   system
> ('C:/Users/.../dssp-2.0.4-win32.exe -i data.txt -o data.dssp')
> it worked.
> Now I want to use the program on a list of files, so for that I used a
> for loop and sprintf
>                                    for (i in 1:10) {
>                                    system
> ('C:/Users/.../dssp-2.0.4-win32.exe -i sprintf("data_%s.txt",i) -o
> sprintf("data_%s.dssp",i)')
> but I received the following error
>                     No such file
>                     Warning message:
>                     running command 'C:/Users/.../dssp-2.0.4-win32.exe
> -i sprintf("data_%s.txt",i) -o sprintf("data_%s.dssp",i)' had status 1
>
>
> SO, what is my mistake? and is there a way to update the input file
> name based on  the for loop counter
>
> Best Regards,
>
> ______________________________________________
> 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.



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

______________________________________________
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.

Reply via email to