Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Just for completeness, there are some ways to prevent you from having this problem. As Dirk said, save your packages in another directory on your computer. </p> <pre><code>install.packages("thepackage",lib="/path/to/directory/with/libraries") </code></pre> <p>You can change the default <code>.Library</code> value using the function <code>.libPaths</code> too</p> <pre><code>.libPaths("/path/to/directory/with/libraries") </code></pre> <p>This will put this path as a first value in the <code>.Library</code> variable, and will make it the default.</p> <p>If you want to automate this further, you can specify this in the Rprofile.site file, which you find in the /etc/ directory of your R build. Then it will load automatically every time R loads, and you don't have to worry about that any more. You can just install and load packages from the specified directory.</p> <p>Finally, I have some small code included in my Rprofile.site allowing me to reinstall all packages when I install a new R version. You just have to list them up <strong>before</strong> you update to the new R version. I do that using an .RData file containing an updated list with all packages.</p> <pre><code>library(utils) ## Check necessary packages load("G:\Setinfo\R\packagelist.RData") # includes a vector "pkgs" installed &lt;- pkgs %in% installed.packages()[, 'Package'] if (length(pkgs[!installed]) &gt;=1){ install.packages(pkgs[!installed]) } </code></pre> <p>I make the packagelist.RData by specifying <code>.Last()</code> in my Rprofile.site. This updates the package list if I installed some :</p> <pre><code>.Last &lt;- function(){ pkgs &lt;- installed.packages()[,1] if (length(pkgs) &gt; length(installed)){ save(pkgs,file="G:\Setinfo\R\packagelist.RData") } } </code></pre> <p>When I install a new R version, I just add the necessary elements to the Rprofile.site file and all packages are reinstalled. I have to adjust the Rprofile.site anyway (using sum contrasts, adding the extra code for Tinn-R, these things), so it's not really extra work. It just takes extra time installing all packages anew.</p> <p>This last bit is equivalent to what is given in the original question as a solution. I just don't need to worry about getting the "installed" list first.</p> <p>Again, this doesn't work flawless if you have packages that are not installed from CRAN. But this code is easily extendible to include those ones too.</p> <p>Edit: There was a missing parenthesis in the code</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload