如何使用renderText将文件打印到Shiny [英] How to print file to Shiny using renderText

查看:209
本文介绍了如何使用renderText将文件打印到Shiny的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在这里错过了一些东西,因为图片没有显示。



谢谢。

  shinyServer(function(input,output){ 
src =einstein.jpg
print(file.exists(src))
out ='< img src =einstein.jpgstyle = width:304px; height:228px ;>'
output $ text3< -renderText(out)

})

shinyUI(fluidPage(

htmlOutput( text3)

))


解决方案

如果您将照片 einstein.jpg 放入应用程序的 img / 子文件夹中,则可以使用<$

$ p $ lt; code> library(shiny)
code> addResourcePath 允许访问它:

shinyApp(ui = fluidPage(htmlOutput(text3)),
server =(function(input,output){
addResourcePath(foo,img)
out ='< ; img src =/ foo / einstein.jpgstyle = width:304px; height:228px;>'
output $ text3< -renderText(out)
}))


I'm missing something here because the image doesn't display.

Thanks.

shinyServer(function(input, output) {
  src = "einstein.jpg"
  print(file.exists(src))
  out = '<img src="einstein.jpg" style=width:304px;height:228px;>'
  output$text3<-renderText(out)

  })

shinyUI(fluidPage(

  htmlOutput("text3")

))

解决方案

If you put your picture einstein.jpg in a img/ subfolder of your app, you can use addResourcePath to allow access to it:

library(shiny)
shinyApp(ui=fluidPage(htmlOutput("text3")),
         server=(function(input, output) {
           addResourcePath("foo", "img")  
           out = '<img src="/foo/einstein.jpg" style=width:304px;height:228px;>'
           output$text3<-renderText(out)
         }))

这篇关于如何使用renderText将文件打印到Shiny的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆