-2

In base R, I am attempting to perform a specific command (i.e. re-render display with re-computed fonts) when the window/device is resized. Moreover, a user is most likely to resize the window during an active input query (as the program is waiting for input/confirmation to proceed). In most programs, I would expect to create a resize callback function, like in GLFW, but I would not be surprised if R does not have such a feature.

I was curious if anybody knew any solutions for handling window resizes in R. I have looked around and could not find any obvious way to do it.

Vadim
  • 642
  • 1
  • 4
  • 19
  • 6
    You will need to privode more information if you want to get help. Best to provide a reproducible example (https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example), but at least provide the type of system, the graphics device you are using and how you are asking for input. – Jan van der Laan Feb 03 '20 at 08:38

1 Answers1

1

Is this Linux or Windows?

If you use base R in Linux and get there using ssh, the command tput cols report the number of columns (i.e. the width) of your terminal. It probably works also directly in a Linux machine without ssh. If you run R in the command line and then run system("tput cols"), it will report you the size of the window. You could always check for the size every few functions and, in the case it changes, do something.

Even though this is definitely a dirty solution and probably not portable, it might point you to the right direction. Good luck.

Carles Borredá
  • 358
  • 2
  • 8
  • The question was ill-defined, and I understand that (I'm too busy to revise it at the moment) but I see that that does help me in the right direction. Thanks! – Vadim Feb 07 '20 at 17:19