5

I'm trying to convert a Shiny app into an R package and I am having trouble with all things regarding the www directory as well as "loose" files.

My shiny app works perfectly but when I try to "package it", it doesn't work.

My shiny app directory:

+---my_shiny
|   +---app.R
|   +---utils.R
|   +---www
|       +---style.css
|       +---icon1.png
|       +---icon2.png
|       +---icon3.png
|       +---font.ttf

My code starts like this:

library(hrbrthemes)
library(tidyverse)
library(plotly)

source(here::here("utils.R"))

theme_set(theme_personalized())
update_geom_defaults("text", list(family = theme_get()$text$family))

ui <- navbarPage(
  "Example",
  id = "navbar",
  theme = "style.css",

Now I down't know how to convert it into a package where I can call myapp::appdemo() and it deploys my app.

+---myapp
|   +---DESCRIPTION
|   +---NAMESPACE  
|   +---R
|       +---appdemo.R
|   +---inst
|       +---shiny/
|           +---app.R
|           +---utils.R
|           +---style.css
|           +---icon1.png
|           +---icon2.png
|           +---icon3.png
|           +---font.ttf

But it doesn't work and I don't know how to make it to.

4
  • Have you had a look here? But I admit that this chapter is not very detailed. The only thing I see in your folder structure is that you use inst/shiny instead of inst/www. Maybe it helps if you change that?
    – starja
    Aug 13, 2020 at 20:00
  • Yes, I did! I think that chapter is not finished yet and hence de "inst/www?". I partially solved the problem by: (i) putting the app and utils on R/ and (ii) by publishing the images online and reading them from the url. The css part is not that simple (I tryied inserting the css on the app itself) :(
    – Paula
    Aug 14, 2020 at 13:49
  • When you install the package, a folder in inst gets copied to the higher level, so inst/www should be correct (or did I miss a change that www is now called shiny?)
    – starja
    Aug 14, 2020 at 14:02
  • 1
    Any update on this?
    – Johan Rosa
    Feb 6, 2022 at 10:54

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.