Я пытаюсь загрузить вывод HTML из блестящего приложения в формате txt или pdf. Мне удалось скачать его как текстовый файл, но он поставляется с HTML-кодом для перерывов, от которых я хочу избавиться. Загрузка работает, когда приложение открыто в браузере. Любая помощь будет оценена. Мой код, как показано ниже.
library(shiny)
server <- shinyServer(function(input, output, session) {
output$textview <- renderUI({
movie <- "Crazy Rich Asians"
summary <- "Rachel Chu is happy to accompany her longtime
boyfriend, Nick, to his best friend's wedding in Singapore. She's
also surprised to learn that Nick's family is extremely
wealthy and he's considered one of the country's most
eligible bachelors. "
director <- "Jon M. Chu"
text <- data.frame(movie,summary,director)
brief=""
details <- text
if (dim(details)[1]<5){
for(i in seq(from=1,to=dim(details)[1])){
brief <-paste(brief,
paste("Movie: ",details[i,"movie"]),
sep="<br/><br/>")
brief <-paste(brief,
paste("Director: ",details[i,"director"]),
sep="<br/><br/>")
brief <-paste(brief,
paste("Summary: ",details[i,"summary"]),
sep="<br/><br/>")
}
save01 <<- brief
}
HTML(brief)
})
output$downloadData <- downloadHandler(
filename = function() {
file <- "saveddetails.txt"
file
},
content = function(file) {
write(save01, file)
}
)
})
ui_panel <-
tabPanel("Multi-Select Input Test",
sidebarLayout(
sidebarPanel(
downloadButton('downloadData', 'Download'),
br()
),
mainPanel(
tabsetPanel(tabPanel("Text",htmlOutput("textview"))
)
)
))
ui <- shinyUI(navbarPage(" ",ui_panel))
runApp(list(ui=ui,server=server))
Будем весьма благодарны за любые предложения или советы о том, как загрузить вывод html в виде txt или pdf файла.