Dear all, I have a package implementing a shiny app, putting the R code of the app (server.R and ui.R) in inst/... and then having a simple function merely starting the app with something along the lines of: runApp(system.file("inst/...")) However, the app itself uses functions from packages which are not used elsewhere in the code. What is the best way to declare these dependencies (using roxygen2)? My 2-cents would be e.g a doc.R file with something along the lines of: [...] #' @importFrom pkg function1 function2 NULL But are their better ways / best practices? On a related topic: are there plans of formally incorporating shiny apps in the structure of a R package, so that the checks will run through the code of the apps as well? Cheers Thibaut =============================Dr Thibaut Jombart MRC Centre for Outbreak Analysis and Modelling Department of Infectious Disease Epidemiology Imperial College - School of Public Health Norfolk Place, London W2 1PG, UK Tel. : 0044 (0)20 7594 3658 http://sites.google.com/site/thibautjombart/ http://sites.google.com/site/therepiproject/ http://adegenet.r-forge.r-project.org/ Twitter: @thibautjombart
On 26/08/2015 6:43 AM, Jombart, Thibaut wrote:> Dear all, > > I have a package implementing a shiny app, putting the R code of the app (server.R and ui.R) in inst/... and then having a simple function merely starting the app with something along the lines of: > runApp(system.file("inst/...")) > > However, the app itself uses functions from packages which are not used elsewhere in the code. What is the best way to declare these dependencies (using roxygen2)? My 2-cents would be e.g a doc.R file with something along the lines of: > [...] > #' @importFrom pkg function1 function2 > NULL > > But are their better ways / best practices?You'll have to ask questions like these on a Shiny forum.> On a related topic: are there plans of formally incorporating shiny apps in the structure of a R package, so that the checks will run through the code of the apps as well?No, but it would be very easy to do: just write a function that tests those things, and call it from a script in the tests directory. Duncan Murdoch
Hi there thanks for the answer.>> But are their better ways / best practices? >You'll have to ask questions like these on a Shiny forum.Done. New thread there: https://goo.gl/17hsAa>> On a related topic: are there plans of formally incorporating shiny apps in the structure of a R package, so that the checks will run through the code of the apps as well?> No, but it would be very easy to do: just write a function that tests > those things, and call it from a script in the tests directory.Yes, though in this case tests would merely check that the code can be sourced without error. I was thinking more of looking for unstated dependencies in code effectively used by the package, though indirectly. I guess it is only relevant if distributing shiny apps alongisde packages becomes common practice. I am not sure how trendy it is yet, but wouldn't be surprised to see it become increasingly frequent. Cheers Thibaut> Duncan Murdoch