Suppress ggpairs messages when creating a graph

ggpairs prints a progress bar and estimates the remaining time when creating graphs, which is nice when used interactively, as some calculations may take several seconds. But when creating documents, such as R-notebooks, these printed messages get into the report. ggpairs has the verbose boolean option, but now it is deprived . Is there an alternative? I can't seem to find him.

To see the messages, try:

library(GGally) ggpairs(mtcars, columns = c("mpg", "cyl", "hp", "disp", "am", "qsec"))

In the document, it ends, including:

plot: [1,1] [== ------------------------------------- --- ---] 4% est: 0s

graph: [1,2] [==== ----------------------------------- --- ---] 8% est: 6s

plot: [1,3] [===== ---------------------------------- --- ---] 12% est: 5s

graph: [1,4] [======= -------------------------------- --- ---] 16% est: 5s

etc.

+5
source share
2 answers

The progress = FALSE argument will work when printing the ggpairs graph.

 ggp = ggpairs(mtcars, columns = c("mpg", "cyl", "hp", "disp")) print(ggp, progress = F) # no progress bar print(ggp) # progress bar 

It may also depend on how you knit . The function that calls the progress bar, ggmatrix_gtable , with a default value

  progress = interactive() && (pm$ncol * pm$nrow) > 15 

Thus, in a non-interactive session, the progress bar is not displayed by default.

+4
source

If you are familiar with the dplyr syntax, perhaps the next one is the most elegant, which does not require storing an intermediate variable

 mtcars %>% ggpairs(columns = c("mpg", "cyl", "hp", "disp", "am", "qsec")) %>% print(progress = F) 
+2
source

Source: https://habr.com/ru/post/1262604/


All Articles