Update R and its libraries [🇷 for BE/BA]

posted by Helmut Homepage – Vienna, Austria, 2019-03-23 19:20 (2083 d 05:30 ago) – Posting: # 20071
Views: 4,493

Dear RUsers,

it is good practice to update R and its libraries regularly. Bugs are removed, new functions added, and performance improved (e.g., subject simulations in PowerTOST run now 100times faster than originally).

Novices please read only the 1st section and ignore the other.
  1. Download-links: Windows, Linux, OS X.
    When asked which flavour (32-, 64-bit, both) to install, opt for the one matching your OS.
    Copy the entire library-folder of the previous installation to the new one. If asked whether newer files should be overwritten, answer N!
    Open the R-console and type update.packages(checkBuilt=TRUE, ask=FALSE). You can make package-maintainers happy when you select the first CRAN mirror (0-Cloud). If you want to be patriotic, select one of the local mirrors close to you.
    That’s all.

  2. Same as above. With 15,000+ packages on CRAN it takes a while till all are compiled (both 32- and 64-bit for Windows; on Linux and OS X one works with the sources anyway) – especially when a new release of R is rolled out. If you are a nerd, likely you have the Rtools and devtools on your machine. If some of your a libraries are not compiled yet, you may see sumfink like this:
      There is a binary version available but the source version is later:
                binary source needs_compilation
    cairoDevice   2.25   2.26              TRUE

    When asked for compilation you can chicken out (N) or bravely answer: Yes, I’m a nerd! This should work if you read all the small print (I didn’t).
    • Rtools have to be installed in C:\Rtools (another location or a network drive is not allowed).
    • Window’s path-variable has to be set appropriately: C:\Rtools\bin; must be the first line (even before C:\Windows;).
    If you are fine with that, you’re done. Happy compiling!

    However, the installer asks whether you want to install it somewhere else. Possible, but not without pitfalls.
    Since you are a nerd, I bet you prefer to have operating system(s) on C, software on D, and data on yet other drive(s). If you installed it say on D (like I did) you will be punished. Though you adapted the path-variable, you are slapped in the face with sumfink like this:
    * installing *source* package 'cairoDevice' ...
    ** package 'cairoDevice' successfully unpacked and MD5 sums checked
    ** libs
    c:/Rtools/mingw_64/bin/gcc -I"D:/PROGRA~2/R/R-35~1.3/include" -DNDEBUG -D_R_=1 -DUSE_R=1 -mms-bitfields -I/include/gtk-2.0 -I/lib/gtk-2.0/include -I/include/atk-1.0 -I/include/cairo -I/include/pango-1.0 -I/include/glib-2.0 -I/lib/glib-2.0/include -I/include/cairo -I/include/gdk-pixbuf-2.0 -I/include -ID:/PROGRA~2/R/R-35~1.3/include -O2 -Wall -std=gnu99 -mtune=generic -c R_init_cairoDevice.c -o R_init_cairoDevice.o
    sh: c:/Rtools/mingw_64/bin/gcc: No such file or directory
    make: *** [D:/PROGRA~2/R/R-35~1.3/etc/x64/Makeconf:208: R_init_cairoDevice.o] Error 127
    ERROR: compilation failed for package 'cairoDevice'
    * removing 'D:/Program Files/R/R-3.5.3/library/cairoDevice'
    * restoring previous 'D:/Program Files/R/R-3.5.3/library/cairoDevice'

    Why the heck? After discussions with the maintainer on GitHub it is clear that the paths to the two compilers are hardcoded (!) to C:/Rtools/mingw_$(WIN)/bin/. Hence, whatever I tried the last years was futile.
    Solution:
    • Delete everything (yes!) pointing to Rtools and its subfolders from the path-variable.
    • Close all R-sessions and start a new one.
      remotes::install_github('jeroen/makeconf')
      library(makeconf)
      makeconf::rtools_setup()

      If you get errors, keep them…
    Now compilation worked with one exception (cause I don’t have libgtk on my machine).
    Checking the DESCRIPTION-file of library Matrix (the compiled version on CRAN is 1.2-16):
    Version: 1.2-17
    Date: 2019-03-11
    NeedsCompilation: yes
    Packaged: 2019-03-20 21:37:04 UTC; maechler
    Date/Publication: 2019-03-22 22:56:52 UTC
    Built: R 3.5.3; x86_64-w64-mingw32; 2019-03-23 16:03:44 UTC; windows

    Bingo!

Dif-tor heh smusma 🖖🏼 Довге життя Україна! [image]
Helmut Schütz
[image]

The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes

Complete thread:

UA Flag
Activity
 Admin contact
23,332 posts in 4,899 threads, 1,660 registered users;
14 visitors (0 registered, 14 guests [including 6 identified bots]).
Forum time: 00:50 CET (Europe/Vienna)

A central lesson of science is that to understand complex issues
(or even simple ones), we must try to free our minds of dogma and
to guarantee the freedom to publish, to contradict, and to experiment.
Arguments from authority are unacceptable.    Carl Sagan

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5