Shinyapps deployment not working while running on local machine

I have the following application which works fine on my computer, however it throws an error when deployed to shinyapps:

ui.R

library(shiny)
library(ggplot2)
library(dplyr)
library(rCharts)
library(DT)
library(htmlwidgets)
library(shinyapps)
# dataset <- ntctidecombined

# Define UI for application that draws a histogram
shinyUI(fluidPage(

  # Application title
  titlePanel("Seattle Society fund raise"),

  # Sidebar with a slider 
  sidebarLayout(position="left",
                sidebarPanel( 

                ),
                mainPanel(
                  #       plotOutput('plot', height="700px"))

                  tabsetPanel(
                    tabPanel("Plot", plotOutput("plot", width = "500px", height = "600px")),
                    tabPanel("Donors / Ticket buyers", tableOutput("donors")),
                    tabPanel("Table", tableOutput("table"))
                  ))

  )
))

      

server.R

library(shiny)
library(ggplot2)
library(dplyr)
library(rCharts)
library(DT)
library(htmlwidgets)
library(shinyapps)

shinyServer(function(input, output) {

  #dataset <- load("ntctidecombined.Rda")
  dataset <- read.csv("https://dl.dropboxusercontent.com/u/9267938/Testspreadsheet.csv")

  dataset1 <- dataset %>% group_by(Category) %>% summarize(Sum = sum(Amount))

  output$plot <- renderPlot({
    dataset2 <- dataset1

  p1 <- ggplot(dataset1, aes(x = Category, y = Sum, fill = Category)) + 
  geom_bar(stat= "identity") + ylab("Total Amount (dollars)") +
  geom_text(aes(Category, Sum, label = Sum, vjust = -1.5)) + 
  coord_cartesian(ylim = c(0,10000))
  p1  

  })

   output$table <- renderTable(dataset1)
   output$donors <- renderTable(dataset)

})

      

When I checked the logs in shinyapps I found that I got an error like this:

Error in file(file, "rt") : https:// URLs are not supported

...

I am trying to use a file that is in Dropbox, so I want to use that file to automatically update graphs and statistics. What's the best way to use data from the internet?

+3


source to share


2 answers


Replace

dataset <- read.csv("https://dl.dropboxusercontent.com/u/9267938/Testspreadsheet.csv")

      

from

library(RCurl)
data <- getURL("https://dl.dropboxusercontent.com/u/9267938/Testspreadsheet.csv")
dataset <- read.csv(text = data )

      



must work.

or in one line

dataset  <- read.csv(text=getURL("https://dl.dropboxusercontent.com/u/9267938/Testspreadsheet.csv"))

      

+2


source


If the url passed to GetURL for Dropbox files should be

https://dl.dropboxusercontent.com/<string for user file.csv>

      



eg. /u/9267938/File.csv

-2


source







All Articles