Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 在屏幕上动态渲染图像_R_Shiny - Fatal编程技术网

R 在屏幕上动态渲染图像

R 在屏幕上动态渲染图像,r,shiny,R,Shiny,我想根据用户在下拉选项中选择的值在我的闪亮应用程序中动态渲染图像。对于用户选择的每个名称,该名称将具有关联的全局\u id。我想使用此全局\u id查找具有匹配全局\u id作为名称的图像,然后显示该图像 这是我的数据示例(装箱) 这些图像位于同一目录下的我的www文件中 这就是我尝试过的 dropdownButton( inputId = 'dropdownA', label='control', icon = ico

我想根据用户在下拉选项中选择的值在我的闪亮应用程序中动态渲染图像。对于用户选择的每个名称,该名称将具有关联的全局\u id。我想使用此全局\u id查找具有匹配全局\u id作为名称的图像,然后显示该图像

这是我的数据示例(装箱)

这些图像位于同一目录下的我的www文件中

这就是我尝试过的

        dropdownButton(
          inputId = 'dropdownA',
          label='control',
          icon = icon("user",lib="glyphicon"),
          status='primary',
          circle=TRUE
        ),
        selectInput("dropdown","Boxer A",
                    choices = unique(boxing$division)),
        uiOutput("Names"),
        imageOutput("boxerA")


server <- function(input,output){
   output$boxerA <- renderImage({
       outimage <- tempfile(fileext = '.jpg')})
下拉按钮(
inputId='dropdownA',
label='control',
图标=图标(“用户”,lib=“glyphicon”),
status='primary',
圆=真
),
选择输入(“下拉列表”、“拳击手A”,
选项=唯一(装箱$division)),
uiOutput(“名称”),
图像输出(“boxerA”)

服务器要集成图像,您应该在
renderImage
中返回一个列表对象,其图像路径为
src


output$plop要添加到已经给出的答案中,还可以使用uiOutput和renderUI渲染图像

因此uiOutput生成所述图像,renderUI接收用户选择的输入并生成您想要显示的图片

这方面的一个例子是:

#replace this
imageOutput("boxerA")
#with this
uiOutput('Picture')
#then add this to server
renderUI({tags$img(src = *picfilename*)})
#replace this
imageOutput("boxerA")
#with this
uiOutput('Picture')
#then add this to server
renderUI({tags$img(src = *picfilename*)})