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?
Related
I have developed a Shiny App that provides some plots which can be filtered and "play" around them. The thing is, I would like to:
Give access to some colleagues. This means that I would like the app to be private, so when someone access the link, a password is needed to enter.
Don't let the user manage the data. I mean, I don't want the user to download the data, so I would like the data be already "there", in a server or something like that. This part should be my responsability, to put the data available for the rest of the colleagues.
I wonder if these things are possible.
For #1 Have a look at shinymanager package, as per this example
For #2 Save the data as a .csv or .rds in the same directory as the app, and load it on visit. You can also utilize shinyjs::hide and shinyjs::show also if you like to make the download buttons invisible
I've created a shiny app that creates a graph based on data that's entered in daily via a shared excel sheet (.xlsx) that is in a shared folder (an L drive).
How would I format or upload the data so that it is able to be refreshed whenever a new daily line of data is entered?
Here is one possible approach along with reference documentations:
Create a workflow to fetch the data using its URL:
read in online xlsx - sheet in R
Make the data retrieval process reactive:
https://shiny.rstudio.com/articles/reactivity-overview.html
Set a reactiveTimer to periodically check for updates:
https://shiny.rstudio.com/reference/shiny/1.0.0/reactiveTimer.html
By doing so, your app will fetch the document on a regular basis to update your graph. If you want real time updates (i.e. every time there is a change in the document), you have to be able to trigger the application from outside, which is more complicated (especially via Excel).
Update:
Following up your comment; you don't need the data to be online. You are fine if you are able to import it into R. Just make this process reactive and set a timer to refresh everyday (see the documentation for examples). Alternatively you can have an actionButton to refresh manually.
I need to render multiple image or plot (whichever faster works for me) in Shiny web app. By multiple I mean about 1000+ image. I am trying to create a kind of dashboard of heat-o-meter gauges to show the status of a server whether it is in healthy condition or not. I am aware of how to render multiple image and plot in Shiny but to scale up to 1000+ and render them in a short amount of time is a challenge. Is there any way to do it in faster?
I have tried several methods such as:
creating multiple plots, putting them into list, and display them
using grid.arrange from gridExtra package. Problem here is
grid.arrange() takes a lot of time to render for 1000+ images.
creating multiple plot in 1 image, save them to png, and display the png file. Also same problem like grid.arrange() method. It takes a lot of time.
Render and save the plot for every servers beforehand in multiple image and display the image when any of the server is
called. Would like to know how esp for 1000+ image? and to render that many images I am afraid there
will be performance issue also.
Any other method? I am wondering if Shiny is able to pre-render all the plots once then let the users see it when they go into the Shiny web-app website. But that does not seem how Shiny works. The web-app process is re-started whenever user access the website.
I have a shiny app which selects a subset of observations from a large dataframe, and then renders r markdown reports against each observation of that subset, zipping them all these reports at the end and downloading the zip file.
When the subset is small (eg less than 10 reports), all works fine, but a network timeout occurs once it takes more than a certain amount of time to render all the reports in the background (eg in some cases more than 100 reports need to be rendered).
I have tried editing the config file to set app_init_timeout = 3600 and app_idle_timeout =3600 but this does not seem to impact this problem....
Any ideas?
I solved this problem by separating the report creation from the download. I used eventReactive to handle the report creation and the zipping of the files, and then made the downloadHandler conditional on the existence of the zip file, so that it only appeared when the downloaded file was ready.
Each time when I run Jmeter script I have to save the summary report and graphs manually.
I want them to be stored automatically.
I tried to write the Summary results to file as C:\JMeter\Summary${__time(ddMMyy HHmmss)}.csv.
But it comes out in XML format. I want in table format.
When I try to save the response graph as following C:\JMeter\ResponseGraph${__time(ddMMyy HHmmss)}.tif.
The graph is not stored. It comes out as invalid image.
Also, please tell me how to analyse the results which I obtain and how should I interpret them If I load test a website.
My website is like log in as a user, search and add products to the basket, process the order, pay for it and view the order which is processed recently.
Look into these answers for details about getting csv results both via GUI and CMD for jmeter's out-of-box components:
How do i get my CSV file?
How to save JMeter Aggregate Report results to a CSV file using command prompt?
To switch between XML/CSV results storage formats for listeners use
either "Configure" dialog of the listener (Sample Result save Configuration: check / uncheck "Save as XML")
or Results file configuration section in jmeter.properties file:
jmeter.save.saveservice.output_format=csv
jmeter.save.saveservice.assertion_results_failure_message=true
jmeter.save.saveservice.default_delimiter=|
You will possibly like this nice set of custom jmeter-plugins - Jmeter Plugins, - especially Graph components and JMeterPluginsCMD Command Line Tool.
Concerning possibility to save generated graphs: I can successfully save created graphs both for Aggregate Graph and Response Time Graph, both in .tif and .png formats (Jmeter v.2.8).
Can assume that you are possibly using your path to store graph as image (C:\JMeter\ResponseGraph${__time(ddMMyy HHmmss)}.tif in question above) in Filename field of Write results to file / Read from file section of Response Time Graph / Aggregate Graph configuration. But this field is for jmeter's results file (.jtl / .csv) write to / read from, not the path to store graph as image.
I'm not sure that you can automatically store generated graphs from this 2 listener (e.g. during test-scenario execution in non-gui mode).
If you need this you can possibly better look into JMeterPluginsCMD Command Line Tool which has option to generate PNG for selected listener (there is example in plugin's usage description).
For log analysis possibilities look into this recent question:
How to analyse Jmeter report?
Add jp#gc - Graphs Generator plugin in your Apache Jmeter. It will create and save chart in user define directory. You must add View Results Tree before it.
enter image description here