What is Nostr?
Mehrad :kde: :emacs: :rstats: /
npub1e8h…7zjt
2024-07-04 11:51:49

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: #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/
Author Public Key
npub1e8hd6qrda9yv3s39u4eka59x43pc0v3ej0ug4c52fz3ka4c6wn8scd7zjt