Last active
April 24, 2020 22:37
-
-
Save skurscheid/490e09353fd59c1b636485087e422225 to your computer and use it in GitHub Desktop.
Obtain names of R packages in a format compatible for installation via conda
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
condaPackages <- function(x){ | |
lapply(names(x$otherPkgs), function(y){ | |
if ("git_url" %in% names(x$otherPkgs[[y]])){ | |
repo = "bioconductor-" | |
} else { | |
repo = "r-" | |
} | |
paste(repo, y, sep ="") | |
}) | |
} | |
# how to run | |
condaPackages(sessionInfo()) | |
# write packages to file which can then be ingested by conda package manager | |
writeLines(unlist(condaPackages(sessionInfo())), con = "packages.txt") | |
# then run conda install --file packages.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment