title: Unable to install rtools and configure the path correctly
body: <p>I followed <a href="http://socserv.mcmaster.ca/jfox/Courses/R/ICPSR/R-install-instructions.html" rel="nofollow noreferrer">this</a> instructions to install R and Rstudio, specifically, in the installation of R, I set <code>C:\R\R-3.4.1</code> as the folder to store R instead of <code>C:\Program Files\R\R-3.4.1</code> to avoid any possible issues with space in the path. Then I followed <a href="http://thecoatlessprofessor.com/programming/rcpp/install-rtools-for-rcpp/" rel="nofollow noreferrer">this</a> instruction step by step to download and install the latest version of <code>rtools</code>. Specifically, during the installation of rtools, there is a message box
  <a href="https://i.stack.imgur.com/GFzJJ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GFzJJ.jpg" alt="enter image description here"></a>
  And I followed the instruction and click both of them.</p>
  
  <p>Then I open <code>Rstudio</code> (at this moment, it is all fresh, I didn't install any R packages except for those basic ones that comes with Rstudio) and <code>install.packages("devtools")</code> then everything looks smooth</p>
  
  <pre><code>package ‘withr’ successfully unpacked and MD5 sums checked
  package ‘devtools’ successfully unpacked and MD5 sums checked
  
  The downloaded binary packages are in
      C:\Users\FTXX\AppData\Local\Temp\RtmpK2EE70\downloaded_packages
  </code></pre>
  
  <p>Then </p>
  
  <pre><code>library(devtools)
  find_rtools(T)
  Error: running command '"C:/R/R-34~1.1/bin/x64/R" --no-site-file --no-
  environ --no-save --no-restore --quiet CMD config CC' had status 65535
  </code></pre>
  
  <p>My system path is</p>
  
  <pre><code>Sys.getenv()['PATH']
  PATH                     C:\R\R-
  3.4.1\bin\x64;c:\Rtools\bin;c:\Rtools\mingw_32\bin;C:\R\R-
  3.4.1\bin;C:\Program
                       Files\mingw-w64\x86_64-5.3.0-posix-seh-rt_v4-rev0\mingw64\bin\;C:\Users\FTXX\AppData\Local\Continuum\Anaconda3;C:\Users\FTXX\AppData\Local\Continuum\Anaconda3\Scripts;C:\Users\FTXX\AppData\Local\Continuum\Anaconda3\Library\bin
  </code></pre>
  
  <p>I also found that the output of <code>Sys.getenv()['PATH']</code> and <code>shell("PATH")</code> generates different message. In <code>Shell('PATH')</code> is 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>I also output some variables</p>
  
  <pre><code>Sys.which("ls.exe")
  ls.exe 
  "c:\\Rtools\\bin\\ls.exe" 
  Sys.which("gcc.exe")
  gcc.exe 
  "c:\\Rtools\\mingw_32\\bin\\gcc.exe" 
  </code></pre>
  
  <p>and my R is 3.4.1 and I am on Windows 10. Any suggestions are appreciated. </p>