I ask for any advice how to do documentaion / auto-documentation for larger shiny applications.
R packages have roxygen2, but are there any equivalents of auto-documentation for shiny server and ui code?
I'm working on a developing project of +15k lines of code and we push as much as possible to packages with roxygen2 docs, however all of the observes and reacts in central server script and its subscripts are not auto-documented. I also use git of course.
I have tried to tag every observe, reactive, module etc in source code with a unique ID and draw a diagram manually with corresponding IDs. The diagram describe what type of sub-element and topic. Later I would add all triggers etc. This process is very manual though. Maybe I could use "the reactive log" https://shiny.rstudio.com/articles/debugging.html to autogenerate such documentation?
...update 1: I have tried ShinyTester which reads through source code and try to predict a network of sub-element interactions. It did not handle sourcing of external files, but with a little debug I manage to get the below diagram. Unfortunately, only 5% of elements and interactions were discovered hereby. Maybe ShinyTester could need some contributions. :
Related
Is it possible to publish an RMarkdown file to Rpubs that takes input and gives out put from the Rpubs site? I want to create a simple calculator related to my job that takes a few inputs and gives an output and, if possible, publish to Rpubs for people to view and use.
SHINY: I know this is what shiny is for, creating interactive apps, but I dont know it very well or how to implement an app I create for multiple people to use, or how to imbed the link to the app, and so on. Just trying to see if this is possible in things I already know how to use
RPubs is for HTML documents that don't require R calculations on the backend. In some instances, there can be some degree of interactivity e.g., brushing and linking plots, filtering data and having the filter propagate to a plot. These happen through the crosstalk package. However, it sounds like you need a shiny app that can take inputs and have R do some calculation of those on the back end. You could host your app on shinyapps.io
It's also possible, depending on how complicated the calculations are, that the entire app could be written in native javascript, which wouldn't require a server-side computation, so could be hosted on any website.
I have a current project that consists of 3 parts:
An interface for clients to upload datasets from their equipment.
Process the uploaded datasets using R and some preset coefficients.
Display in a graph with a regression line, allowing the user to click points on the graph to remove them where needed and redraw the regression line automatically (after point removed).
Part 1: This is already done using PHP/Laravel. A simple upload and processing interface.
Part 3: I've been able to set this up in chart.js without any problems.
Part 2 is the sticking point at the moment. What I'd like is to be able to send the data to an rscript and just get the datapoints back so that I can display them. Can anyone give suggestions as to the best way to do this? Is there an api available? Or do I need to install software on the server (not an issue if I do, but I'm hoping to avoid the need to if possible)?
TIA
Carton
There is the package shiny to do everything in R (user side GUI and server side R processing). Since you did it in PHP already, you can either write an R script that is being executed with a shell call from PHP, or build an R REST API with plumber
I want to create a product/project documentation in R that is going to be reviewed and discussed by a group of reviews. There are plenty of examples of how to create book-like documents using Rmarkdown (e.g. https://bookdown.org/) or interactive data visualizations using R-shiny. However, I could not find any solution for user comments similar to LibreOffice Writer, MS Word, or Google Docs. I could also imagine having a split-pane where one side is dedicated to the content presentation (e.g. text, graphs, code), while the other side is left for comments.
I am aware that such a solution requires a server-side solution for storing comments.
Any hints on existing solutions, workarounds, and implementations are welcome.
If I correctly understood, your question isn't very R specific. R is just code, R files are just text and they don't allow comments (beside the raw hashtag comments) and reviews. Your question is more about version control environments, that allow reviews on code stuff. The most used version control system is git, and git has an integrated panel in RStudio.
Git allows you to split your developpements in branches, which are the different ideas you and your coworkers can work on independentely. Once an idea is finalised, after some consecutive modifications known as commits, it is to be asked for merge in the "main branch". It is a "pull request".
That is where the different platform using git, like GitHub or GitLab, allow some review systems. Basically, when a branch is done, you ask "is that ok ?". Your reviewer can see the changes, can try you things, and tell if that is actually ok.
The other advantage of these is the continuous integration, that is : elaborating tests (in R with testthat) that will be tested on some events merge, like "on each merge to master". It is meant to ensure that the software is going forward : if a merge breaks some earlier test, you'll know it.
For beginners, in order to avoid being lost in bash commands, GitHub Desktop is a fine GUI above Git.
Note : You can also rely on the package usethis which has a few helper functions like use_git, use_gitlab_ci, use_github_action... It's not specific to reviews and comments but to the gitlab and github integration
I am using Biblioshiny for Bibliometric analysis. As I am quite new to R, and would like to learn more about the underlaying code used by biblioshiny; I was wondering if it is possible to see the resulting R-code generated through the options configured in the web interface in biblishiny. E.g. when creating a ci-citation network in Biblioshiny, can I see the actual executed R-code used to generate this network?
Recently. I though perhaps one can enable a debug-mode and/or see the code through some logs. I do not know if this is the case, or if better solutions exists.
I'm debugging a Shiny web app, and would like to see the entire control flow/execution path over the course of rendering and updating the generated website.
Is there a way to capture/print/dump-to-file every line of code that is executed in the process of rendering/updating a Shiny app? It would also be good (maybe better?) to see every line of R code parsed by the running R interpreter instance; I'm not concerned about length of this output, and would prefer to get things as verbosely as possible.
I have looked into the stack tracing Shiny functions but these seem to be intended for error catching/handling/reporting. The app is not generating errors/warnings, just setting some variables to NULL at some point when they shouldn't be, so I'm not sure if this is the right approach. These stack tracing functions also seem to be more localized, designed to operate within a given reactive variable/function/render rather than following the control/execution flow across differing reactives/rendering functions in an app.
This app is a large, company-internal app so I cannot give a MRE/MWE.
I finally found the profvis package that does more-or-less exactly what I want by taking a snapshot of the execution stack at a fixed time interval (default 10ms). I'm still working on using this tool to debug, but I believe this will get me there and would also be useful to others debugging Shiny apps that need more than browser() and/or reactlog.
Specifically, I have been doing:
#install.packages("profvis")
library(profvis)
exec_log <- profvis(runApp("myShinyApp"))
...interact with the myShinyApp web page enough to trigger the bug, then interrupt execution...
print(exec_log)