Mehrad :kde: :emacs: :rstats: on Nostr: Have you ever suffered by the `Rplot.pdf` littering your working directory when ...
Have you ever suffered by the `Rplot.pdf` littering your working directory when running your #rstats code in a pipeline? Have you dreamed of being able to pipe the output to `/dev/null` instead of the default device in R?
Well, the solution is super easy: add this to beginning of your code
```r
if(!interactive()){
options(device = function(...) {
.Call("R_GD_nullDevice", PACKAGE = "grDevices")
})
}
```
Inspired by Yihui Xie (npub1mj3…h8q7) post: https://yihui.org/en/2010/12/a-special-graphics-device-in-r-the-null-device/
Well, the solution is super easy: add this to beginning of your code
```r
if(!interactive()){
options(device = function(...) {
.Call("R_GD_nullDevice", PACKAGE = "grDevices")
})
}
```
Inspired by Yihui Xie (npub1mj3…h8q7) post: https://yihui.org/en/2010/12/a-special-graphics-device-in-r-the-null-device/