Skip to content

Instantly share code, notes, and snippets.

@goddoe
Last active January 9, 2018 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goddoe/7a48237e1c7a4596a4032cdeb74dd553 to your computer and use it in GitHub Desktop.
Save goddoe/7a48237e1c7a4596a4032cdeb74dd553 to your computer and use it in GitHub Desktop.
Methods to update R repository's PACKAGES file fast
#!/usr/bin/env bash
Rscript update_r_packages.R --dir "local_cran/src/contrib"
#!/usr/bin/env Rscript
library("cranlike")
library("optparse")
# default Value
repos_path = "local_cran/src/contrib"
# Read arguments
option_list = list(
make_option(c("-d", "--dir"), type="character", default=repos_path,
help="path of repos", metavar="character")
)
opt_parser = OptionParser(option_list=option_list)
opt = parse_args(opt_parser)
# main
print("update packages...")
print(opt$dir)
update_PACKAGES(dir=opt$dir, type="source")
print("done")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment