I want to create an automatic report in my shiny Application.
I imagine to create a button at the bottom of all pages of my application.
If you click, all graphs and tables are automatically stored in a list of outputs.
At the end of the analyse, you click in a big button, and you generate an automatic word report with all your outputs inside.
I have no idea to do that.
Do you have some examples ?
When I read on the web is a script *.Rmd separated to UI.R and Server.R.
All outputs are inside the *.Rmd .
But I want that the user have the choice to save outputs they wants.
Many thanks for your advices.
Maïna
Related
I have an R shiny app that allows users to upload a dataset, interactively subset it and then save it to the server. I also have several test files that are structured just like the files expected from the future users. I would like to write an automated testing script that uploads one of the datasets, randomly subsets the table (selecting rows in datatable, clicking action buttons) and then clicks a button to save it to the server. The user input to the app should be partly random and I need the clickstream of the user as an output to compare it to the saved dataset.
Is there a way to do this with shinytest or is that just for predefined clickstreams?
I do not know how to illustrate this with a simple example. The problem is this:
I generate and display a flextable in a Shiny app and want to place it in a PDF. The only available method is to convert the flextable object to a PNG then place the PNG in the PDF. This works fine, except users are reporting strange results - getting the report with a table that looks nothing like that displayed in the app. I suspect that occasionally users are executing reports very close in time so that the last saved png is grabbed, but it was saved by another user.
The PNG files (there are three) are placed in the app directory, which I believe is not isolated from one user session to another. In the PDF I cannot use relative paths so I cannot save it to a different directory.
Any suggestions?
Have you tried naming the images with a unique key, such as a per-report number getting the images named something like chart_0153927_01.png instead of chart_01.png for report #0153927? Or something like a millisecond/microsecond timestamp set once at the start of the session to reduce collisions?
In my shiny application, I would like to have a textarea field that allows the users to give text input. This can be done with:
ui.R:
tags$textarea(id="item",rows=3,cols=40,placeholder="Type your message...")
verbatimTextOutput("news")
server.R:
output$news <- renderText(input$item)
With this code, I can only see the text input within the current session of the app. My goal is, to save user text input permanently in the app (user gives text input, submits and data will be displayed in the app permanently).
Is this possible with shiny? My idea was to store the data in a global way like googlesheets.
One option is to write the text entry to disk as a plain text file, likely each time the user chooses to (e.g., by hitting a "Submit" button). You can use an actionButton and have an observeEvent that includes the code to save to disk.
Note that you will need to have unique file names to avoid overwriting. You could either use time stamps or take a look at the uuid package to generate random names.
If you are more comfortable with databases, you could, alternatively, set up a SQL table and append a line for each user submission (this would be substantially more reliable, allow you to store meta data with it, and avoid the file naming issues above).
Shiny itself is not designed to store data, though the authors have written up some suggested approaches (available here).
In my shiny application, I have noticed that when I have multiple tabs, each time I click on the tab, the output is recalculated. I wasn't expecting this behavior since no inputs were changed. How can I keep it so that it only recalculates once an actual input is changed?
You can prepare your calculataions prior and save them to name.rda file with save function, and then add a line load("name.rda") at the beggining of the server.r file - the data will be loaded only at the beggining of your application. Can't help much without your code.
Let's say I have 10 reports, each of which contain 1 or more tables and charts.
I want to allow a user to select a bar chart from report 1, a grid and pie chart from report 2, a grid from report 3 etc to create a composite report.
I think I have a solution in Telerik whereby I combine multiple reports together, as sub-reports, and hide all elements (tables, charts) except the ones that the user wants to include. If all elements are placed inside min-sized panels then white space should disappear as elements are hidden. I've done a quick test using this method and it appears to work.
My question is, is this the best way to approach the requirment? Are there better approaches with other tools such as Crystal Reports, ActiveReports and DevExpress?
Jules
Are you trying to combine these report at run time? In ActiveReports, these 3 reports can be run separately and then all the three of them can be combined to create one report document or individual pages from these can be combined together to create another report document. This document can then be viewed in any of the viewers, printed or exported to pdf and excel and such.
At design time, it is doable but is not worth it. Will need some code to make sure that the layout is first created correctly based on user selection of certain kind of report and then you will have to make sure that correct data is getting fed prior to running the report.