0

I have tired loading libraries , so i decided to use something like this:

library(purrr)

map(list(dplyr,ggplot2,rcompanion),library)

and failed. So the only way why - packages are not the object, aren't they ?

  • 2
    Packages are not themselves objects, they are scripts, and within those scripts there are (in most cases) classes and methods to work with instances of those classes (objects) but the package itself is a script...with a highly curated packaging paradigm. – sconfluentus Dec 22 '19 at 08:40
  • Does this answer your question? [Load multiple packages at once](https://stackoverflow.com/questions/8175912/load-multiple-packages-at-once) – NelsonGon Dec 22 '19 at 15:53

2 Answers2

0

As described here (Load multiple packages at once), you can specify a list of packages to load and use the following code to load them:

listpackage = c("dplyr","ggplot2","survival", "data.table", "edgeR", "DESeq2")

lapply(listpackage, require, character.only = TRUE)
dc37
  • 15,840
  • 4
  • 15
  • 32
0

Thanks for help! With your comments i have built purrr way:

load_packages <- partial(require,character.only=TRUE)

packages <- list('ggplot2','rcompanion')

map(packages,load_packages)