I would like to generate a new html table every time the user changes the parameter "mass" below, and then exhibit it dynamically
server.R
library(hwriter)
shinyServer(function(input, output) {
output$distPlot <- renderText({
mass <- as.numeric(input$mass)
win <- as.numeric(input$sswin)
m1 <- mass-win/2
m2 <- mass+win/2
etr <- paste0("http://rest.kegg.jp/find/compound/", m1, "-", m2, "/exact_mass")
tb <- read.table(etr)
colnames(tb) <- c("id", "mass")
#p <- openPage('test.html')
tblk <- cbind(paste0("http://www.kegg.jp/dbget-bin/www_bget?", tb[,1]), NA)
#hwrite(tb, p, link = tblk)
hwrite(tb, link = tblk)
#close(p)
})
})
ui.R
library(shiny)
shinyUI(fluidPage(
sidebarLayout(
sidebarPanel(
textInput("mass", "Mass:", "200.05"),
textInput("sswin", "Search window:", "0.5")
),
# Show a plot of the generated distribution
mainPanel(
#plotOutput("distPlot"),
#includeHTML("test.html")
uiOutput("distPlot")
)
)
))
The table is being generated, but I don't know how to update it.
I figured out a way and edited above.