-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
87 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
Package: myFun | ||
Type: Package | ||
Title: myFun is a collection of my favorite R functions, packaged for simplicity | ||
Version: 1.0.7 | ||
Date: 2023-01-08 | ||
Version: 1.0.8 | ||
Date: 2024-02-20 | ||
Authors@R: person("Tom", "Lesluyes", email = "[email protected]", role = c("aut", "cre")) | ||
Author: Tom Lesluyes [aut, cre] | ||
Maintainer: Tom Lesluyes <[email protected]> | ||
|
@@ -18,6 +18,7 @@ Imports: | |
GenomicRanges, | ||
IRanges, | ||
doParallel, | ||
foreach | ||
foreach, | ||
rvest | ||
Roxygen: list(markdown = TRUE) | ||
RoxygenNote: 7.2.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#' @title Rpackages | ||
#' @description List installed packages and determine their source | ||
#' @details This function lists installed packages and determine whether they are base packages or come from CRAN/Bioconductor or if they are external (GitHub, SourceForge, etc.). This function requires an internet connection. | ||
#' @param CRAN_URL the CRAN URL (default: "http://cran.us.r-project.org") | ||
#' @param Bioconductor_URL the Bioconductor URL (default: "https://www.bioconductor.org/packages/release/bioc/") | ||
#' @return A data.frame with the installed packages and an additional column: Source (possible values: Base, CRAN, Bioconductor, External) | ||
#' @examples head(Rpackages()) | ||
#' @author tlesluyes | ||
#' @export | ||
Rpackages=function(CRAN_URL="http://cran.us.r-project.org", | ||
Bioconductor_URL="https://www.bioconductor.org/packages/release/bioc/") { | ||
# Pick CRAN packages | ||
CRAN=as.data.frame(available.packages(repos=CRAN_URL))[, c("Package"), drop=FALSE] | ||
CRAN$Source="CRAN" | ||
# Pick Bioconductor packages | ||
url=url(Bioconductor_URL, "rb") | ||
Bioconductor=as.data.frame(rvest::html_table(rvest::read_html(url))[[1]])[, c("Package"), drop=FALSE] | ||
close(url) | ||
Bioconductor$Source="Bioconductor" | ||
# Pick installed packages | ||
myPackages=as.data.frame(installed.packages()) | ||
# Determine the source of each installed package | ||
myPackages$Source=foreach::foreach(i=myPackages$Package, .combine=c) %do% { | ||
# Test whether it is from CRAN and/or Bioconductor | ||
FROM=c(ifelse(i %in% CRAN$Package, "CRAN", NA), | ||
ifelse(i %in% Bioconductor$Package, "Bioconductor", NA)) | ||
FROM=FROM[!is.na(FROM)] | ||
# If it is not from CRAN or Bioconductor, test whether it is a base package | ||
if (length(FROM)==0 && i %in% c("base", "compiler", "datasets", "grDevices", "graphics", "grid", "methods", "parallel", "splines", "stats", "stats4", "tcltk", "tools", "utils")) FROM="Base" | ||
# Otherwise, it looks like an external package | ||
if (length(FROM)==0) FROM="External" | ||
# The collapse is needed if a package exists in both CRAN and Bioconductor (not sure this could happen though) | ||
return(paste0(FROM, collapse="/")) | ||
} | ||
return(myPackages) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
#' @importFrom foreach %dopar% | ||
#' @importFrom foreach %do% | ||
NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.