10.4 Publishing

Finally, we have our app ready, and we need to put it somewhere. We could host it ourselves, that’s not too hard, but what if we want to share on the World Wide Web (www for short)?

One option is using shinyapps.io to host our completed app on the cloud. We get like a few hours a month free for hosting, and there’s a fun little button in RStudio that let’s us do it automatically.

Follow the sign up steps to log into shinyapps.io and then use rsconnect to setup the connection to your app.

Exercise 5 - Art

If you thought this Shiny stuff was stuffy and boring, you might be right! But it can also make art, really easily!

Try to get the following code working, and then visit here to see what other functions are available and try to do your own! Uncomment line 1 to install the package, you may need to run install.packages("devtools") first.

# devtools::install_github("taytayp/aRt")
library(aRt)
library(shiny)

ui <- fluidPage(
  column(width=6,
  sliderInput("slide", "How many hills?", 2, 20, 2),
  radioButtons("pal", "What color?",
               c("ag_Sunset", "Earth", "Tropic", "Sunset", "SunsetDark"))),
  column(width=6, plotOutput("plot", width = "400px", height = "400px"))
)
server <- function(input, output, session) {
  output$plot <- renderPlot(
    fading(n_layers=input$slide, n_points=1, col_palette=input$pal)
  )
}
shinyApp(ui, server)