Skip to content

Instantly share code, notes, and snippets.

@skurscheid
Last active April 24, 2020 22:37
Show Gist options
  • Save skurscheid/490e09353fd59c1b636485087e422225 to your computer and use it in GitHub Desktop.
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
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