How can I get screen resolution (height, width) in pixels for any OS with R? The closest approach I could find is below but still could not work in Linux? Any suggestions?
library(rJava)
.jinit()
toolkit <- J("java.awt.Toolkit")
default_toolkit <- .jrcall(toolkit, "getDefaultToolkit")
dim <- .jrcall(default_toolkit, "getScreenSize")
height <- .jcall(dim, "D", "getHeight")
width <- .jcall(dim, "D", "getWidth")