File: compatipleVersions.R

package info (click to toggle)
r-bioc-annotate 1.84.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,624 kB
  • sloc: makefile: 2
file content (22 lines) | stat: -rw-r--r-- 618 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Checks the DESCRIPTION file to see if the packages whose names are
# passed have the same version number

compatibleVersions <- function(...){
    pkgs <- list(...)
    versions <- NULL
    for(i in pkgs){
        options(show.error.messages = FALSE, warn = -1)
        versions <- try(c(versions, packageDescription(i)[["Version"]]))
        options(show.error.messages = TRUE, warn = 0)

        if(inherits(versions, "try-error")){
            stop(paste("Package", i, "is not in the library"))
        }
    }

    if(length(unique(versions)) == 1){
        return(TRUE)
    }else{
        return(FALSE)
    }
}