Create a SaveTo-Dialog in flexdashboard with shiny - r

I'm quite lost... I'd like to add a save-button to my shiny/flexdashboard-app. First I tried to use 'shiny files' but it seems that this doesn't work with rmarkdown somehow.
Is there another possibility to create a decent "save-to"-Dialog (like a dialog opens up, one can choose the path and set a filename, hits OK and the file gets saved (the saving-part is no problem))?
Any help is highly appreciated.
Best Regards
Daniel

A combination of downloadButton() (or downloadLink()) and downloadHandler() should also work in flexdashboard. You can find the documentation here.

Related

Is it possible to auto trigger snippets in Rstudio?

With Rstudio you can add customized snippets but always they should be triggered using TAB or SHIFT-TAB depending on if you are in R or Rmd file.
Is it possible just to trigger the snippet by typing the sequence of characters?
For example, just by typing dm it will create an equation environment without the TAB or SHIFT-TAB intervention.
I'm thinking in something like this especially for typing documents fast with a lot of math and code mixed.
Thanks for any help!
According to the RStudio devs this feature is not possible right now.
https://github.com/rstudio/rstudio/issues/6834

RStudio Programmatically Set Directory in Files Tab

I am trying to programmatically set directory in the Files tab within RStudio. The version of RStuido is 1.1.453. I have tried looking within rstudioapi package but the relevant functions that I found selectDirectory() and selectFile() open an interactive file tree browser and they do not change the Files tab content. I know that one can use setwd() then in the Files tab use More -> Go To Working Directory but I need to do this fully programmatically.
In summary I wish there was a function setFilesTab(dirpath = ) which I could submit and the Files tab would change the focus to the dirpath.
Thank you so much for your help and time!
This is my first post on this website; so, hello to all.
I am excited to be part of this community.
Just adding to the answer by RoyalTS, I wanted to specifically tell the files tab to open the working directory. This code works:
rstudioapi::filesPaneNavigate(getwd())
Cheers,
Jason

Multiple pdf files in one embed

I need your help over a problem I have. Actually, I have a page with a simple embed which displays a PDF file.
I got a request to add another PDF file to the same embed (or at least to do something which would look like it).
I searched some solutions and not finding a simple one, I'm thinking about using iTextSharp to merge both files (by getting their stream from their url), merging them into a new pdf file and display this resulting file into the embed.
But I'm just telling myself it's a bit too much for such a simple modification... And so I'm here asking you if someone would have a better idea ? From what I searched on stackoverflow and google it looks like I will have to take the merge solution but hey, we never know '^^
A simpler option would be to merge the two PDF files using either a free online tool or Adobe Combine Files option and then adding that newly combined PDF to your site. Unless I am missing something, there is no real reason or benefit to do this using code.

Automatically reloading shiny app when add changes

I would like to have an option (when working locally) which allows me to see changes in my shiny app automatically after I put some changes in server.R or ui.R file. It is really annoying to manually rerun runApp function every time I add a new thing.
The optimal solution which I really like is xaringan::inifinite_moon_reader function which is extremely helpful.
Is there any solution which do this stuff?
You can find analogical solution here. On the right, the code was modified and saved, on the left, the content of page was updated.
Executing
options(shiny.autoreload = TRUE)
should do the trick.

Display a .dot file inside a Qt application

I am new to Qt and C++... Now, I am writing an application in Qt, in which I have to display an already generated .dot file inside my application. I tried the render function but did not work for me.. Can anyone out there help me in this regard..
Thanks
Had the same problem using Python. I came up with this solution:
svg_string = dot_graph.create_svg(prog='dot')
svgWidget = QtSvg.QSvgWidget()
svgWidget.load(QtCore.QByteArray(svg_string))
Guess you can do something similar in C++
Plotting directly a dot file requires to be able to display the nodes in the correct positions, and link them properly. This is done by very complicated engines and is not included in the dot file, which is simply a description of the graph. Maybe there are C++/Qt libraries that take dot files as an input, but I don't know them.
According to this topic (Graphviz: How to go from .dot to a graph?), you can easily transform a dot file into a png or svg file. If you want to display the rendered graph into your application, the easiest thing to do is to generate that png picture (from the shell or from your code) and to manipulate it from your program.
Take a look to QGraph. You will need much more work to make your graphs interactive.
Anyway, if you are new to Qt, even the simple display it's a steep introduction to graphics.
I have my own implementation, but I'm sorry it's not yet ready for publishing - I will do in a SWI-Prolog context...

Resources