title: Error using library(caret) in RStudio
body: <p>I have been trying to use caret library for a simple ML application. I am using the latest versions of R (3.4.3) and RStudio (1.1.414). Here is my approach</p>
  
  <pre><code>install.packages("caret",repos = "http://cran.r-project.org", dependencies = c("Depends", "Imports", "Suggests"))
  </code></pre>
  
  <p>when I run the code library(caret) I get the following error</p>
  
  <pre><code>Error: package or namespace load failed for ‘caret’ in loadNamespace(j &lt;- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
   there is no package called ‘gower’
  </code></pre>
  
  <p>Now I went forward and installed the packages that it suggests one by one i.e., DEoptimR, gower, etc. This list never ends as once I install a package it will ask for another package. I am so frustrated. I have literally looked up in every forum but it did not solve my problem. I am not sure why the code install.package does not install all the required packages even though I ask explicitly to do so. when I check .libPaths() I can see it has access to both my library directories</p>
  
  <pre><code>[1] "C:/Users/omid/Documents/R/win-library/3.4"
  [2] "C:/Program Files/R/R-3.4.3/library" 
  </code></pre>
  
  <p>would anyone be able to help please?</p>
  
  <p>Edit 1:</p>
  
  <pre><code>install.packages("caret",repos = "https://cran.r-project.org", dependencies = c("Depends", "Imports"))
  Installing package into ‘C:/Users/omidm/Documents/R/win-library/3.4’
  (as ‘lib’ is unspecified)
  trying URL 'https://cran.r-project.org/bin/windows/contrib/3.4/caret_6.0-78.zip'
  Content type 'application/zip' length 5155777 bytes (4.9 MB)
  downloaded 4.9 MB
  
  package ‘caret’ successfully unpacked and MD5 sums checked
  
  The downloaded binary packages are in
      C:\Users\omidm\AppData\Local\Temp\RtmpGuZ1vH\downloaded_packages
  
  library(caret)
  Loading required package: lattice
  Loading required package: ggplot2
  Error: package or namespace load failed for ‘caret’ in loadNamespace(j &lt;- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
   there is no package called ‘gower’
  </code></pre>
  
  <p>I also uninstalled R and RStudio and installed them again. Still getting the same error.</p>
  
  <p>Solved:</p>
  
  <p>I managed to solve this issue somehow, however, I am still not sure how. here is what I did</p>
  
  <p>Open R GUI (not RStudio) and run:</p>
  
  <pre><code>install.packages("installr") # install 
  installr::updateR() # updating R
  </code></pre>
  
  <p>type q() to exit and then open RStudio. Go to Packages and Update all packages</p>
  
  <p>Install package caret as per comments from @chinsoon and @Ronald</p>
  
  <pre><code>install.packages("caret", dependencies=c("Depends", "Imports"))
  </code></pre>
  
  <p>if you still get an error about any package just install that one. It will not ask for any other packages as you have removed "Suggest" from dependencies. Hope this manages to solve some people's problem.</p>