title: how to invoke System Command in an R function
body: <p>I want to make an R script that invokes the system command.</p>
  
  <p>The Linux command I want to use in the R script is:</p>
  
  <pre><code>plink --bfile myPlinkBinaryData --recode --out myPlinkTextData
  </code></pre>
  
  <p>So far this is what I have in my R file:</p>
  
  <pre><code>setwd("/Users/swirlydino/Desktop/OriginalData")
  getwd()
  system("plink --bfile OriginalData --recode --out myPlinkTextData")
  </code></pre>
  
  <p>However, I get this:</p>
  
  <pre><code>Web-based version check ( --noweb to skip )
  Recent cached web-check found...Problem connecting to web
  
  Writing this text to log file [ myPlinkTextData.log ]
  Analysis started: Wed Sep  6 14:28:48 2017
  
  Options in effect:
      --bfile OriginalData
      --recode
      --out myPlinkTextData
  
  
  ERROR: No file [ OriginalData.fam ] exists.
  </code></pre>
  
  <p>When I run the command, plink --bfile OriginalData --recode --out myPlinkTextData, in Terminal it works and creates the two files I need. So how come it is not working in the R script?</p>
  
  <p>Any help will be so grateful :)</p>