title: What is the difference between Sys.getenv('PATH') and shell("PATH") in R
body: <p>I was trying to install a package in R for two computers.</p>
  
  <p>On my laptop A, it is successfully installed and for the other one B, I was not able to install it. Then I did hours search on google and realize that the problem may be lies in the system (or environment, I am not sure if these 2 words are equal) varibles. </p>
  
  <p>I used <code>Sys.getenv('PATH')</code> and <code>shell("PATH")</code> on my laptop A, and it generates exactly the same results, except for under <code>Sys.getenv('PATH')</code>, the directories all have "\\" while under <code>shell("PATH")</code>, it is <code>\</code>. That is the only difference. </p>
  
  <p>Then I try to see if on computer B, the one that I was not able to install an R package, <code>Sys.getenv('PATH')</code> and <code>shell("PATH")</code> will generate the same result. I found that <code>Sys.getenv("PATH")</code> gives a set of reasonable directories separated by ;, but <code>shell("PATH")</code> says</p>
  
  <pre><code>Warning messages:
  1: running command 'C:\Program Files\mingw-w64\x86_64-5.3.0-posix-seh-rt_v4-rev0\mingw64\bin /c PATH' had status 127 
  2: In shell("PATH") : 'PATH' execution failed with error code 127
  </code></pre>
  
  <p>What is the difference between Sys.getenv('PATH') and shell("PATH") in R? The computer A is on Windows7 and computer B is on Windows10</p>