I'm not awesome at interpreting R functions and I'm using code from Callahan et al., 2017 to install Bioconductor packages. Their script is as follows:

.bioc_packages <- c("dada2", "phyloseq", "DECIPHER", "phangorn") .inst <- .bioc_packages %in% installed.packages() if(any(!.inst)) { source("") biocLite(.bioc_packages[!.inst], ask = F) } 

And I have two questions:

  1. What does the syntax if(any(!.inst)) accomplish? I understand the structure of a function, but I don't know specifically what this particular section "means".

  2. Bioconductor is using BiocManager with R versions greater than 3.5 (I'm on 4.1.2) so the above code gives me the error:

With R version 3.5 or greater, install Bioconductor packages using BiocManager; see

How may I edit the function to address this error?

Thank you!

1 Answer

Probably best to ask this on the Bioconductor support site .

I'd suggest

## we need BiocManager from CRAN if (!"BiocManager" %in% rownames(installed.packages())) install.packages("BiocManager", repos = "") ## install or update required packages .bioc_packages <- c("dada2", "phyloseq", "DECIPHER", "phangorn") BiocManager::install(.bioc_packages) 

This will install all packages (and their dependencies) that are not already installed, will update any packages that are not current (for the release of Bioconductor that you are using -- per Bioconductor guidelines, these will be bug fixes only), and will say that it will not re-install packages that are already installed with their current version.

Note that with R-4.1.2 you will not get the most recent version of Bioconductor. You might update to R-4.2.1 (because you want to be using current versions of these packages, and because you might want to do other analyses in Bioconductor involving packages that have been introduced since the Bioconductor version available with R-4.1.2) or downgrade to the R version used in the paper you cite (because you want to more closely reproduce results from the paper).

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.