Selecting image sections in R GUI? - r

I'm trying to write an R function that allows a user to select a rectangle within a displayed image. The selection could then be used for zooming, copying or other manipulation. The gwidgets package appears to provide this functionality for many of its widgets, but not for images. Does anyone have a suggestion for where to turn next?
Thanks!

Related

How do you see your viewer items in R studio?

How can I see previous tables that I generated in the viewer instead of only the most recent thing that I ran? For example if I've run several tables and changed one or two things and I wanted to be able to compare them side by side, how do I see them both? I'm thinking about how I can scroll through an SPSS output file.
I'm not sure if this is a code thing or a settings thing. Opening a new window doesn't seem to do anything. Refreshing the viewer doesn't seem to change anything.
I can put things in the viewer no problem using view() or expss_output_viewer or out="viewer".
I can only seem to get it to display the most recent table I ran.
Click the arrows in the upper left of the viewer pane to see previously plotted tables.
Image of viewer pane with arrows highlighted
Using flextable
flextable(mtcars)
Using expss
expss_output_viewer()
as.etable(mtcars)

Adding a responsive sidebar to a Leaflet application in R

I am building a Leaflet application in R. I want polygons in my map to be clickable. A side bar should then show additional information about the clicked element.
The only solution I could find are in Javascript, such as this one:
https://github.com/turbo87/leaflet-sidebar/
I only use R and don't know how/if I can combine that with Javascript

How to add vector icons as tab in react-native-scrollable-tab-view

There is a gif image that shows you can add vector icons as tab in react-native-scrollable-tab-view as per image below:
I already look and google everywhere I can look into. I cannot find a way to do this without altering the package.
Need help on how to achieve like in this image where you can see they use vector icons as tab.
Appreciate all the help. Thanks
Actually you have to implement this TabBar by yourself. But luckily, you can mimic the "FacebookExample" to achieve it. I think it's not too difficult. Here is the js file of the Facebook TabBar.
https://github.com/ptomasroos/react-native-scrollable-tab-view/blob/master/Example/FacebookTabBar.js

Hooking up a function to window resize operation in R

I have a function that shows a plot consisting mainly a lot of text (a modified version of the wordcloud function from the wordcloud package). Resizing the window without resizing the text looks bad. I would like to create a custom hook for a function called whenever the plot window is resized.
How can I do this, programatically, in R, if it can be done at all?
This document talks about the display list and what happens when graphics are resized. I don't see a way to redo the calculations with base graphics, though there may be a hook that can be set. If you use grid graphics instead of base graphics then the linked document has some suggestions that may trigger the recalculations you want.

How do I change the WM icon for a gwindow() using gWidgets in R?

I would like to change the Window Manager icon (in the top left corner of my gwindow()), using gWidgets in R. I want to add my own picture rather than using the R logo in the corner. I have loaded the picture into R, just by calling gimage("imagename.jpg"). I can manage to open this image up in a window, by calling gimage("imagename.jpg", cont=gwindow(cont=T)), but not as the icon.
I feel like this should be something really simple to do. I have googled how to do it, but can't find an answer. I found that, using RGtk2, you just add the argument icon=imagename when creating the window.
I tried this with gWidgets as well by calling gwindow(icon=gimage("imagename.jpg"), cont=T), however this didn't do anything different than just calling gwindow without the extra argument.
This seems like it should be really simple, but I can't find an answer anywhere. Any help would be greatly appreciated.
Thanks.
There is nothing in gWidgets here to help, but if you load RGtk2, then the setIcon method of the GtkWindow can help you, but you need to get it first:
Try something like:
w <- gwindow()
require(RGtk2)
img <- gdkPixbufNewFromFile("your_icon.png")
getToolkitWidget(w)$setIcon(img$retval)

Resources