<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/quick-way-of-installing-all-your-old-r-libraries-on-a-new-device/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://feedproxy.google.com/~r/RDiscoveringPythonR/~3/efLgJKnw298/"> R – Discovering Python &amp; R</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>I recently bought a new <a rel="nofollow" href="http://www.dell.com/in/p/inspiron-15-5559-laptop/pd" target="_blank">laptop </a>and began installing essential software all over again, including R of course! And I wanted all the libraries that I had installed in my previous laptop. Instead of installing libraries one by one all over again, I did the following:</p>
<p><strong>Step 1: Save a list of packages installed in your old computing device (from your old device).</strong></p>
<p><code><br>
installed &lt;- as.data.frame(installed.packages())<br>
write.csv(installed, 'installed_previously.csv')<br>
</code></p>
<p>This saves information on installed packages in a csv file named installed_previously.csv. Now copy or e-mail this file to your new device and access it from your working directory in R.</p>
<p><strong>Step 2: Create a list of libraries from your old list that were not already installed when you freshly download R (from your new device).</strong></p>
<p><code><br>
installedPreviously &lt;- read.csv('installed_previously.csv')<br>
baseR &lt;- as.data.frame(installed.packages())<br>
toInstall &lt;- setdiff(installedPreviously, baseR)<br>
</code></p>
<p>We now have a list of libraries that were installed in your previous computer in addition to the R packages already installed when you download R. So you now go ahead and install these libraries.</p>
<p><strong>Step 3: Download this list of libraries.</strong></p>
<p><code><br>
install.packages(toInstall)<br>
</code></p>
<p>That’s it. Save yourself the trouble installing packages one-by-one all over again.</p>
<p><img data-orig-file="https://pythonandr.files.wordpress.com/2017/07/installing_libraries_r.png?w=456" data-orig-size="968,911" data-medium-file="https://pythonandr.files.wordpress.com/2017/07/installing_libraries_r.png?w=456?w=300" data-attachment-id="2301" data-image-meta="{" data-image-description="" src="https://pythonandr.files.wordpress.com/2017/07/installing_libraries_r.png?w=456" data-permalink="https://pythonandr.com/2017/07/27/quick-way-of-installing-all-your-old-r-libraries-on-a-new-device/installing_libraries_r/#main" data-large-file="https://pythonandr.files.wordpress.com/2017/07/installing_libraries_r.png?w=456?w=700" alt="installing_libraries_R" data-image-title="installing_libraries_R" sizes="(max-width: 700px) 100vw, 700px" data-comments-opened="1" class="wp-image-2301" data-recalc-dims="1"></p>
<p> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/pythonandr.wordpress.com/2255/" target="_blank"><img border="0" alt="" src="http://feeds.wordpress.com/1.0/comments/pythonandr.wordpress.com/2255/"></a> <img border="0" alt="" src="https://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" data-recalc-dims="1"><img alt="" width="1" src="http://feeds.feedburner.com/~r/RDiscoveringPythonR/~4/efLgJKnw298" height="1"></p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://feedproxy.google.com/~r/RDiscoveringPythonR/~3/efLgJKnw298/"> R – Discovering Python &amp; R</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/twQGLJ_VHEk" height="1"></a></div>