Automatic documentations of functions for Shiny app using RStudio - r

I am developing a Shiny app at the moment and getting to a point with more functions than I expected. I plan to start automated testing with testthat and I would love to document my functions with roxygen2.
Since I am using RStudio, I started a new shiny app project. Now I am wondering, since I want the documentation and testing done, if I should instead start a package in RStudio to get all the devtools functions.
I am wondering, how to get the functions documented properly and like in the build, to test the examples. Plus using the testthat functions. How can I set up a project like this?

Since I found now a workflow which works for me, I described this on a different question.
developing shiny app as a package and deploying it to shiny server

Related

How to run a shiny app as a standalone application?

I've some shiny app and I want to execute and to make it standalone application (it will be awesome if it will open via chrome).
I can't upload the app to the Net and I want that also co-workers without R studio or R
will use this app.
because of the security company - I can't download any software except R packages.
I saw here a few solution, but all of them included any software download.
I have done some research on this issue. The commenters are basically correct: you need the R binaries in some way, either a portable R or an R server. But there are solutions that allow it to bundle those with your code and hide the details from your users.
On option is to wrap your app along with
a portable R into a container application like Electron. The electron-quick-start project tries this.
The RInno package provides functions to bundle your app and R portable into an installer app. Every user runs the installer on their system once which will install your app, the packages and the code. But in the end users may not see the difference to other apps. They get a link in the start menu and that's it. I did that successfully. But it did not work out of the box. I had to adjust the output manually in several places.
A second container solution works with docker. That is what ShinyProxy does. See also this blog.
The package shinyShortcut (I quote) "will produce an executable file that runs the shiny app directly in the user's default browser".
Important to note: I haven't tested most of them. From reviewing the solutions I often get the feeling that these solutions might make releases somewhat complicated because there are always manual steps involved.

Deploying on shinyapps.io: A package dependency should not be required, yet Shiny asks for it

I am building a Shiny application based on an unpublished package. I have, therefore, explicitly created stand-alone functions of parts of this unpublished package. Shiny call these functions when needed. On my local machine, Shiny is not calling this unpublished package. I have even uninstalled this package to make sure that Shiny is independently functioning.
Yet, when I deploy this package to shinyapps.io, I face an error about this unpublished package is required.
I suspected that an earlier Shiny deployment of this app might have interfered and that this dependencies is an echo. So I removed that earlier version to make sure that this app is not interfering with the new app. But the same problem persists.
In summary, a package dependency should not be required, yet Shinyapps asks for it.Any idea of what is going on?
Not sure how to write a reproducible example of this particular issue.
(NB: I have posted this question \[here\]\[1\] as well as [here][2])

How to make sure the user of a shiny app is using the right package versions in R

Due to recent experience with several bugs created by updating packages, I wonder what the best approach is for the following problem:
I currently provide a stand alone version so to say of my shiny App (just the script files to run it locally) and run a long list of require() functions to load / install the needed packages. However, in the end I would like to use fixed package versions to avoid bugs created by changes in packages.
Is there a way to ensure that the user, who may have older or newer versions of packages on their computer, is using the right version of all the packages my app needs?
You can consider using packrat: https://rstudio.github.io/packrat/.
Unfortunately, private libraries don’t travel well; like all R
libraries, their contents are compiled for your specific machine
architecture, operating system, and R version. Packrat lets you
snapshot the state of your private library, which saves to your
project directory whatever information packrat needs to be able to
recreate that same private library on another machine.
Short tutorial:
RStudio - File - New Project - New Directory - New Project - "Do: use Path" - Create Project
Enter in the R(Studio) console:
Code:
packrat::init()
.libPaths() # test if libpath has changed
install.packages("reshape2") # installs within one of the packrat libpaths
Installing package into ‘C:/R/packRatTest/packrat/lib/x86_64-w64-mingw32/3.4.3’
Assumption would be that you can use and share RStudio Projects, but i think it would be hard to work without them anyway ;).
Try writing your shiny app as a package. You can, somewhat, control that through the description file.
Since you said you're using script take a look at: https://github.com/chasemc/electricShine
Even of you don't use it, hopefully looking at the code will help for things like setting the download repo to be a specific MRAN date.

Can't get madlib.forest_train() in Rstudio by using PivotalR library

I have configured RStudio to run R code natively on Greenplum. I have searched online but I couldn't find answer to the problem I am facing at the moment.
I have imported the library(PivotalR) and library(RPostgreSQL). But, when I type madlib it just comes up with few of the functions:
The Greenplum database has also been configured with Madlib functions including madlib.forest_train, which does not show up in RStudio. I am assuming it has something to do with the PivotalR package for RStudio. Is there a way to make the forest_train work directly from RStudio?

reducing cycle of redeployment of Shiny Applications in RStudio

Whenever I make changes to Shiny Applications made through RStudio and which is hosted in shiny apps, I have to redeploy it which takes time. How can it this redeployment time be cut short. What automatic functionality or package can be added to achieve this?
Unfortunately there's not a way to reduce the time taken to deploy a package to ShinyApps currently. But we do recommend that you develop and test the package locally before deploying it to ShinyApps. That way you can iterate on your application very quickly by testing locally using the shiny::runApp() command then when you're happy with your application, deploy to ShinyApps.io.

Resources