Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

embed iframe inside shiny app

Tags:

this is my UI. R

shinyUI(fluidPage(titlePanel("Getting Iframe"),                sidebarLayout(                   sidebarPanel(                       fluidRow(                           column(6,                                  selectInput("Member", label=h5("Choose a option"),                                              choices=c('BCRA1','FITM2'))                           ))),                   mainPanel(fluidRow(                       column(3, htmlOutput("frame"))                   )                   )               ))) 

This is my server.R

library(shiny) members <- data.frame(name=c("Name 1", "Name 2"), nr=c('BCRA1','FITM2'))   shinyServer(function(input, output) { loadframe <- reactive({      validate(         need(input$Member, "Member input is null!!")     )     query <- members[which(members$nr==input$Member),2]     paste0("http://news.scibite.com/scibites/news.html?q=GENE$",query)  })  output$frame <- renderUI({     tags$iframe(src=loadframe(), height=600, width=535)    })  }) 

I want to get the iframe from the web page but its printing blank any help on this would be appreciated ?

like image 949
user4959 Avatar asked Oct 08 '15 15:10

user4959


1 Answers

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)     print(my_test)     my_test   }) }  shinyApp(ui, server) 

enter image description here

like image 169
Pork Chop Avatar answered Nov 10 '22 00:11

Pork Chop