Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get RStudio Viewer pane dimensions programmatically

Tags:

r

rstudio

Is it possible to get current RStudio Viewer pane dimensions programmatically?

This article describes how to set them (height only):

https://support.rstudio.com/hc/en-us/articles/202133558-Extending-RStudio-with-the-Viewer-Pane

like image 607
Daniel Krizian Avatar asked Mar 19 '23 10:03

Daniel Krizian


2 Answers

grDevices::dev.size("px") returns the width/height of the current graphics device in pixels (and will open the default device if none is already open). Since RStudio's graphics device size is tied to the viewer's size, this function also returns the size of the (non-zoomed) viewer pane.

like image 162
Carson Avatar answered Apr 07 '23 10:04

Carson


This currently isn't possible, the RStudio API doesn't seem to expose those parameters at the moment. That's what I imply from the reply by RStudio staff here.

like image 28
Daniel Krizian Avatar answered Apr 07 '23 10:04

Daniel Krizian