"Article","DOI"
"First","doi:10.1039/C4CP02345G"
"Second","doi:10.1039/C4CP02175G"
"Third","doi:10.1039/C4CP02325G"
...
library(shiny)
data <- read.table("articles.csv", header = T, sep = ",", stringsAsFactors = F)
library(DT)
shinyServer(function(input, output, session) {
output$x1 = DT::renderDataTable(data, server = FALSE)
output$addtag <- renderUI({
# From example https://yihui.shinyapps.io/DT-info/
t1 = input$x1_rows_current
tt <- if (is.null(t1) || t1 == '') 'Nothing' else {
data[t1, "DOI"]
}
tags$meta(name="doi", content=tt)
})
})
fluidPage(
title = 'DataTable on articles',
uiOutput("addtag"),
h1('Table'),
fluidRow(
column(6, DT::dataTableOutput('x1')),
column(6, plotOutput('x2', height = 500))
)
)
library(shiny)
data <- read.table("articles.csv", header = T, sep = ",", stringsAsFactors = F)
ui <- fluidPage(
title = 'DataTable on articles',
h1('Table'), fluidRow( column(6, DT::dataTableOutput('x1')), column(6, plotOutput('x2', height = 500)) ))
server <- function(input, output, session) { output$x1 <- DT::renderDataTable(data, server = FALSE) observe({ t1 <- input$x1_rows_current
tt <- if (is.null(t1) || t1 == '') 'Nothing' else { data[t1, "DOI"] }
insertUI( selector = "head", where = "beforeEnd", immediate = TRUE, tags$head(tags$meta(name="doi", content=tt)) ) })}shinyApp(ui, server)
observe({ t1 <- input$x1_rows_current tt <- if (is.null(t1) || t1 == '') NULL else { data[t1, "DOI"] } removeUI( selector = "[name='doi']", multiple = TRUE, immediate = TRUE )
insertUI( selector = "head", where = "beforeEnd", immediate = TRUE, tags$head(tags$meta(name="doi", content=tt)) ) })