Last active
September 1, 2022 18:48
-
-
Save cecilialee/46e5ec16237cf17bf9a5e971edb332f7 to your computer and use it in GitHub Desktop.
Embed iFrame in Shiny #r #shiny
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
members <- data.frame(name=c("Name 1", "Name 2"), nr=c('BCRA1','FITM2')) | |
ui <- fluidPage(titlePanel("Getting Iframe"), | |
sidebarLayout( | |
sidebarPanel( | |
fluidRow( | |
column(6, selectInput("Member", label=h5("Choose a option"),choices=c('BCRA1','FITM2')) | |
))), | |
mainPanel(fluidRow( | |
htmlOutput("frame") | |
) | |
) | |
)) | |
server <- function(input, output) { | |
observe({ | |
query <- members[which(members$nr==input$Member),2] | |
test <<- paste0("http://news.scibite.com/scibites/news.html?q=GENE$",query) | |
}) | |
output$frame <- renderUI({ | |
input$Member | |
my_test <- tags$iframe(src=test, height=600, width=535, frameborder = "no") | |
print(my_test) | |
my_test | |
}) | |
} | |
shinyApp(ui, server) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
scibrokes/owner#2 (comment)