0

I am loading multiple packages using the following code.

Packages <- c("gridExtra", "scatterplot3d", "plot3D", "gridExtra", "plyr", "ggplot2", "magrittr", "reshape2", "data.table")
lapply(Packages, library, character.only = TRUE)

and it prints following loading messages

## [[1]]
## [1] "gridExtra" "stats"     "graphics"  "grDevices" "utils"     "datasets" 
## [7] "methods"   "base"     
## 
## [[2]]
## [1] "scatterplot3d" "gridExtra"     "stats"         "graphics"     
## [5] "grDevices"     "utils"         "datasets"      "methods"      
## [9] "base"         
## 
## [[3]]
##  [1] "plot3D"        "scatterplot3d" "gridExtra"     "stats"        
##  [5] "graphics"      "grDevices"     "utils"         "datasets"     
##  [9] "methods"       "base"         
## 
## [[4]]
##  [1] "plot3D"        "scatterplot3d" "gridExtra"     "stats"        
##  [5] "graphics"      "grDevices"     "utils"         "datasets"     
##  [9] "methods"       "base"         
## 
## [[5]]
##  [1] "plyr"          "plot3D"        "scatterplot3d" "gridExtra"    
##  [5] "stats"         "graphics"      "grDevices"     "utils"        
##  [9] "datasets"      "methods"       "base"         
## 
## [[6]]
##  [1] "ggplot2"       "plyr"          "plot3D"        "scatterplot3d"
##  [5] "gridExtra"     "stats"         "graphics"      "grDevices"    
##  [9] "utils"         "datasets"      "methods"       "base"

I tried suppressWarnings and suppressMessages but it didn't solve the problem

suppressWarnings(suppressMessages(Packages <- c("gridExtra", "scatterplot3d", "plot3D", "gridExtra", "plyr", "ggplot2", "magrittr", "reshape2", "data.table")))
suppressWarnings(suppressMessages(lapply(Packages, library, character.only = TRUE)))

I looked at these STO posts but they didn't help enter link description here enter link description here

Malintha
  • 4,512
  • 9
  • 48
  • 82

1 Answers1

2

This "message" is the return value of the lapply command. If you don't want to see this information, assign the result to a variable.

x <- lapply(Packages, library, character.only = TRUE)
Sven Hohenstein
  • 80,497
  • 17
  • 145
  • 168