How to run ASReml via shell in R

91 Views Asked by At

I am trying to run a .bat file via R, which contains input files for ASReml. The .bat file is working correctly when executed in the Windows cmd prompt, but I can't get it working via R. The code that I use was working before (some months ago) but now it's giving me errors.

The .bat file looks like this:

> batfile.univariate
      [,1]                              
 [1,] "asreml -nw31 1_Yr2WT.as"         
 [2,] "asreml -nw31 2_Yr2Fat.as"        
 [3,] "asreml -nw31 3_Yr3WT.as"         
 [4,] "asreml -nw31 4_Yr3Fat.as"        
 [5,] "asreml -nw31 5_HarvWT.as"        
 [6,] "asreml -nw31 6_FatPC.as"         
 [7,] "asreml -nw31 7_HarvDefCode.as"   
 [8,] "asreml -nw31 8_HarvMatureCode.as"
 [9,] "asreml -nw31 9_HarvSurv.as"      
[10,] "asreml -nw31 10_SRSDTD.as" 

The code that I am using to run the batfile is this:

for (i in batfile.univariate) {shell(i, intern = TRUE)}

And the error code is this:

    Warning messages:
1: In system(cmd, intern = intern, wait = wait | intern, show.output.on.console = wait,  :
  running command 'C:\WINDOWS\system32\cmd.exe /c asreml -nw31 1_Yr2WT.as' had status 1
2: In system(cmd, intern = intern, wait = wait | intern, show.output.on.console = wait,  :
  running command 'C:\WINDOWS\system32\cmd.exe /c asreml -nw31 2_Yr2Fat.as' had status 1
3: In system(cmd, intern = intern, wait = wait | intern, show.output.on.console = wait,  :
  running command 'C:\WINDOWS\system32\cmd.exe /c asreml -nw31 3_Yr3WT.as' had status 1
4: In system(cmd, intern = intern, wait = wait | intern, show.output.on.console = wait,  :
  running command 'C:\WINDOWS\system32\cmd.exe /c asreml -nw31 4_Yr3Fat.as' had status 1
5: In system(cmd, intern = intern, wait = wait | intern, show.output.on.console = wait,  :
  running command 'C:\WINDOWS\system32\cmd.exe /c asreml -nw31 5_HarvWT.as' had status 1
6: In system(cmd, intern = intern, wait = wait | intern, show.output.on.console = wait,  :
  running command 'C:\WINDOWS\system32\cmd.exe /c asreml -nw31 6_FatPC.as' had status 1
7: In system(cmd, intern = intern, wait = wait | intern, show.output.on.console = wait,  :
  running command 'C:\WINDOWS\system32\cmd.exe /c asreml -nw31 7_HarvDefCode.as' had status 1
8: In system(cmd, intern = intern, wait = wait | intern, show.output.on.console = wait,  :
  running command 'C:\WINDOWS\system32\cmd.exe /c asreml -nw31 8_HarvMatureCode.as' had status 1
9: In system(cmd, intern = intern, wait = wait | intern, show.output.on.console = wait,  :
  running command 'C:\WINDOWS\system32\cmd.exe /c asreml -nw31 9_HarvSurv.as' had status 1
10: In system(cmd, intern = intern, wait = wait | intern, show.output.on.console = wait,  :
  running command 'C:\WINDOWS\system32\cmd.exe /c asreml -nw31 10_SRSDTD.as' had status 1

Does anyone have a suggestion what I am doing wrong? Thank you very much!

0

There are 0 best solutions below