mercredi 30 décembre 2015

R Shiny: Combining with Rvest

I am trying to use R Shiny with the Rvest package so when a date is selected as an input I can lookup a webpage based on it and scrape some of the data. When I input the full address it works but when I try and combine the reactive input$date I get an error message that I "cannon coerce type closure to vector or type character" I have been searching around and have been unable to find a solution. Still pretty new to shiny. Thanks

ui <- fluidPage(
  column(4,wellPanel(
dateInput('date',
          label = 'Date Input: yyyy-mm-dd',
          value = Sys.Date())
  )),
  column(6,
     verbatimTextOutput("Name")
     )
)

server <- function(input, output){
  output$Name <- renderText({
paste(as.character(Name))
  })
  ds <- reactive({input$date})
  address <- paste0("http://ift.tt/1R9zGON",ds)
  BBPress <- html(address)
  Name <- BBPress %>%
html_node(".player-link") %>%
html_text()
}

shinyApp(ui = ui, server = server)




Aucun commentaire:

Enregistrer un commentaire