在闪亮的应用程序中呈现网页集合

时间:2016-03-13 03:11:42

标签: r shiny webpage

我正在尝试将一组网页呈现为Shiny中的瓷砖。我有css代码来创建瓷砖。虽然程序运行时没有任何错误消息,但我没有在屏幕上填充页面。相反,当我单击磁贴时,它会打开一个新选项卡并填充页面。以下是可重复的df

structure(list(author = c("DHYANI1811", "THE_PARALLEL_ME", "IMRITIKTHAKUR", 
"IMRITIKTHAKUR", "IMRITIKTHAKUR"), article_url = c("http://twitter.com/Dhyani1811/statuses/667885170591006721", 
"http://twitter.com/The_Parallel_Me/statuses/667883209607114752", 
"http://twitter.com/imRitikThakur/statuses/667880559704600576", 
"http://twitter.com/imRitikThakur/statuses/667880186638012416", 
"http://twitter.com/imRitikThakur/statuses/667880150910963712"
), sentimet = c("neg", "pos", "neu", "pos", "pos")), .Names = c("author", 
"article_url", "sentimet"), row.names = c(NA, 5L), class = "data.frame")

代码:

library(shiny)
library(shinydashboard)


df 

runApp(list(ui= fluidPage(
    titlePanel("opening web pages"),

    mainPanel(
        htmlOutput("test")
    )
),
server = function(input, output, session) {

    k <- reactiveValues(active = df,
                        first.load = FALSE)

    output$test <- renderUI({
        if(k$first.load){
            js$showInfo()
            k$first.load = TRUE
        }

        if(length(k) == 0)
            return(h2("No possible data"))

        fluidRow(
            column(12, id="columns",
                   lapply(df$article_url, function(i) {
                       a(box(width=NULL,
                             title = HTML(paste("<div class='image-wrap'><img src= ''",
                                                df$img[df$article_url == i],
                                                "'class='",
                                                df$img[df$article_url == i],
                                                "'></div>", 
                                                "<strong>By:",
                                                df$author[df$article_url == i],
                                                "</strong><br>",
                                                '<span style="font-size: 11pt;">Sentiment: ',
                                                df$sentimet[df$article_url == i],
                                                '</span>'
                             ))
                       ), href=paste(i), target="_blank") 


                   }
                   )))
    })   
})
)

我已将title = HTML(paste("<div class='image-wrap'>更改为HTML(readLines或已使用return(HTML(readLines以及其他各种类似的组合。

0 个答案:

没有答案