celestialgod

library多個R套件,並且沒安裝的自動安裝

Oct 4th, 2016
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.48 KB | None | 0 0
  1. # library多個套件,並且沒安裝的自動安裝
  2. library(pipeR)
  3. library_mul <- function(..., lib.loc = NULL, quietly = FALSE, warn.conflicts = TRUE){
  4.   pkgs <- as.list(substitute(list(...))) %>>% sapply(as.character) %>>% setdiff("list")
  5.   if (any(!pkgs %in% installed.packages()))
  6.     install.packeges(pkgs[!pkgs %in% installed.packages()])
  7.   sapply(pkgs, library, character.only = TRUE, lib.loc = lib.loc, quietly = quietly) %>>% invisible
  8. }
  9. library_mul(httr, pipeR, data.table)
Advertisement
Add Comment
Please, Sign In to add comment