Automatically install or update all phylogenetics packages in R

In case you are unaware of this trick, it is possible to simultaneously install or update all of the phylogenetics packages available in R in one fail swoop.

A number of different CRAN Task Views have been created summarizing R packages and utilities for different fields of analysis or research. Luckily, there is not only a compilation of these located on the CRAN-R website here, but also Brian O’Meara (@omearabrian #omearabrian) has developed a nice CRAN Task View entitled “Phylogenetics, Especially Comparative Methods.” This means that you can view all of the software for phylogenetics and phylogenetic comparative methods in R at one time from the corresponding Phylogenetics website. Here is what these websites look like:

CRAN_Task_Views_screenshotOmeara_Phylogenetics_ctv

 

 

 

The most important thing, though, is that you can automatically install the entire Phylogenetics, Especially Comparative Methods view! Here’s how you do it! First, open R, download the ctv package(ctv stands for “CRAN Task Views”), then load the ctv library by typing:

 library(ctv) 

 

Next, you can install the Phylogenetics, Especially Comparative Methods view using the ‘install.views’ function, and later you can update this view using the ‘update.views’ function. If this is your first time using R for phylogenetics, you will not have any of the phylogenetics software, so you will do the following to install the view:

install.views('Phylogenetics')

 

If you have already been working with phylogenies in R and have some of the related packages installed, you will want to use update.views as follows:

update.views('Phylogenetics') 

 

This will check through all of the packages in the Phylogenetics, Especially Comparative Methods view and update packages you already have installed, while also installing for the first time any packages that are missing. Here, an important note to make is that you must 1) be connected to the internet to do this, and 2) realize that this could take a substantial amount of time to install all of the packages. So, only do this when you have time!!

~J

Posted in blog posts, Phylogenetics, R and tagged , , , , , , , .

3 Comments

  1. I’m getting this error msg after installing and loading ctv and trying this in R studio.

    > update.views(‘Phylogenetics’)
    Error in url(paste(contriburl[i], “Views.rds”, sep = “/”), open = “rb”) :
    for https:// URLs use setInternet2(TRUE)

    Or, if I assume that I don’t have any phylogenetics packages already:

    > install.views(‘Phylogenetics’)
    Error in url(paste(contriburl[i], “Views.rds”, sep = “/”), open = “rb”) :
    for https:// URLs use setInternet2(TRUE)

  2. Hi David, this works fine for me in RStudio. I just tried it. Here is my screen output to prove it:

    > library(ctv)
    > update.views(‘Phylogenetics’)
    Warning: dependency ‘phyloseq’ is not available
    also installing the dependencies ‘WikipediR’, ‘bindr’, ‘solrium’, ‘WikidataR’, ‘bindrcpp’, ‘glue’, ‘pkgconfig’, ‘rlang’, ‘tibble’, ‘plogr’, ‘tkrplot’, ‘rredlist’, ‘ritis’, ‘worrms’, ‘natserv’, ‘wikitaxa’, ‘dplyr’

    There is a binary version available but the source version is
    later:
    binary source needs_compilation
    expands 1.7.2 2.0.0 FALSE

    trying URL ‘https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.3/WikipediR_1.5.0.tgz’
    Content type ‘application/x-gzip’ length 63871 bytes (62 KB)
    ==================================================
    downloaded 62 KB

    trying URL ‘https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.3/bindr_0.1.tgz’
    Content type ‘application/x-gzip’ length 12121 bytes (11 KB)
    ==================================================
    downloaded 11 KB

    trying URL ‘https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.3/solrium_0.4.0.tgz’
    Content type ‘application/x-gzip’ length 270793 bytes (264 KB)
    ==================================================
    downloaded 264 KB

    trying URL ‘https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.3/WikidataR_1.3.0.tgz’
    Content type ‘application/x-gzip’ length 41080 bytes (40 KB)
    ==================================================
    downloaded 40 KB



    The downloaded source packages are in
    ‘/private/var/folders/qy/50knq60d42z3gwjxhx0gm8bc0000gn/T/RtmpC0JEC8/downloaded_packages’

  3. David, I think your best bet is to follow the suggestion that R is giving you at the end of each error, “for https:// URLs use setInternet2(TRUE).” This means open R or RStudio and type in setInternet2(TRUE), then try to update the view again and see if it works. Another option might be to try and run R as an administrator, or try R on a machine where you have administrator privileges. Let me know if any of this works. ~J

Leave a Reply

Your email address will not be published. Required fields are marked *