Guest User

Untitled

a guest
Oct 22nd, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. library(stringr)
  2. library(twitteR)
  3. library(plyr)
  4. library(ROAuth)
  5. library(base64enc)
  6. library(shiny)
  7. require(RJSONIO)
  8. library(RMySQL) # will load DBI as well
  9.  
  10. options(shiny.sanitize.errors = FALSE)
  11.  
  12. lapply( dbListConnections( dbDriver( drv = "MySQL")), dbDisconnect)
  13.  
  14. con <- dbConnect(dbDriver("MySQL"), user = "user_name", password = "passowrd", dbname = "db_name", host="remotehost.org")
  15.  
  16. on.exit(dbDisconnect(con))
  17.  
  18. test <- dbGetQuery(con, paste("SELECT * FROM tablename WHERE columnname = '","'"))
  19.  
  20. ui <- fluidPage(textOutput(outputId="jsonoutput"))
  21.  
  22. server <- function(input, output) {
  23. output$jsonoutput <- renderText({
  24. toJSON(list(NLP = test))
  25. })
  26.  
  27.  
  28. }
  29.  
  30. dbDisconnect(con)
  31.  
  32. shinyApp(ui = ui, server = server)
Add Comment
Please, Sign In to add comment