Re: [R] Shell command help

From: Uwe Ligges <ligges_at_statistik.tu-dortmund.de>
Date: Thu, 03 Jun 2010 18:03:50 +0200

On 03.06.2010 04:19, galen kaufman wrote:
>
> Uwe,
>
>
>
> Thank you so much for the response. I tried running the command in the format you suggested but still could not get the shell command to execute. The following is the command that I used per your suggestion and the subsequent error message.
>
>
>
> shell('"C:\\programx.exe"' -import '"C:\\inputx.inp"' -run -quit)

This cannot work. Is this all expected to be the first argument of shell()? If so, you need to quote it as a whole.

> #Error that is returned from above code…..
>
>> 'C:\Program' is not recognized as an internal or external command, operable program or>batch file

Since the above command cannot work, this error message is the resukt from another call you have not given.
Particularly the "c:\Program" points us to a problem with spaces in the directory "Program Files" but since you have not used that in your call from R, it must be something in C:\programx.exe or C:\inputx.inp that causes the problem, but it is not R related - unless you have used a completely different call.

>> Warning message:
>> In shell("\"C:\\programx.exe\" -import>\"C:\\input.inp\" -run -quit") :
> >'"C:\programx.exe" -import "C:\input.inp" -run -quit' execution failed with error code 1

These two lines are also from two different calls. I don't see the ">" from the first line is in the second line now....

So, *please* copy and paste only code and error messages that fit to each other!

Uwe Ligges

> Thinking that it may be a problem with the command line I checked with developer of the program and he said that it should be the correct language.
>
>
>
> Any thoughts?
>
>
>
> Thank you again,
>
>
>
> Galen
>
>
>
>
>> Date: Mon, 3 May 2010 09:19:49 +0200
>> From: ligges_at_statistik.tu-dortmund.de
>> To: leavealetter1_at_hotmail.com
>> CC: r-help_at_r-project.org
>> Subject: Re: [R] Shell command help
>>
>>
>>
>> On 02.05.2010 21:55, galen kaufman wrote:
>>>
>>> Dear R Community,
>>>
>>> I am trying to run a command line in R that will open an external program, have it import a specific input file, run the program, then close the program. The command line that I got from the developer of the model to do this looks like what you see below:
>>>
>>> c:\programx.exe -import 'inputx.inp' -run -quit
>>>
>>> I have been trying to use shell() or shell.exec() to run this in R. I can get R to open the program but I have not been able to do the rest of the steps.
>>>
>>> I have been able to open the model using :
>>>
>>>> shell('"C:\\programx.exe"')
>>>
>>> or
>>>
>>>> shell.exec("C:\\programx.exe")
>>>
>>> To do the rest I have been trying variations of the following:
>>>
>>>> shell('"C:\\programx.exe"' -import '"C:\\inputx.inp"' -run –quit)
>>
>>
>>
>> Hm, you need to pass one string to the shell (and the underlking
>> system()) call:
>>
>> shell('"C:\\programx.exe" -import "C:\\inputx.inp" -run –quit')
>>
>> Best,
>> Uwe Ligges
>>
>>
>>
>>> but I am not getting anywhere.
>>>
>>> Can you provide any insight as to how to do the rest?
>>>
>>> Thank you,
>>>
>>> Galen
>>> _________________________________________________________________
>>> Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
>>>
>>> N:WL:en-US:WM_HMP:042010_2
>>> [[alternative HTML version deleted]]
>>>
>>>
>>>
>>>
>>> ______________________________________________
>>> 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.
>
> _________________________________________________________________
> The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
> http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4



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. Received on Thu 03 Jun 2010 - 16:06:10 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 03 Jun 2010 - 16:20:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive