I like to read white on black. So, in R I would do something along the lines of:
par (bg = "black")
par (fg = "ivory1")
I would like these options to be set by default. However, one does not simply write these lines in .Rprofile
because, as I understand, at the time it gets executed, the graphical device is not yet initialized. Rather, as suggested in another answer, one should re-assign options()$device
to include the necessary option setting. I did not have success in that.
This is what I tried:
~/.Rprofile
f_device <- options()$device
blackdevice <- function (...) {
f_device(...)
par (bg = "black")
par (fg = "ivory1")
}
options (device = blackdevice)
The idea here is to save the original device
function to another variable, and then call it from my new device
function. What I get is:
Error in f_device(...) : could not find function "f_device"
— At the time I run plot (something)
.
Another idea I had is to go like that:
~/.Rprofile
.First <- function () {
options(f_device = options()$device)
blackdevice <- function (...) {
options()$f_device(...)
par (bg = "black")
par (fg = "ivory1")
}
options (device = blackdevice)
}
— Assigning the original device
someplace else in options
. But this leads to:
Error in (function (...) : attempt to apply non-function
I'm out of ideas. Can you help me figure this out?