小编Mys*_*nge的帖子

仅当主面板中出现输出时,才在 Shiny R 中显示下载按钮

我有下面的代码,它允许接受 csv 文件 -> 运行 R 代码 -> 显示 -> 下载输出。

但是,只要应用程序运行,就会出现下载按钮。有没有办法只在输出文件可用时显示输出按钮?

下面是我正在使用的代码:

用户界面

library(shiny)

#ui.R
# Define UI for random distribution application 
shinyUI(fluidPage(

  # Application title
  titlePanel("Text Mining on R"),

  sidebarLayout(
    sidebarPanel(
      fileInput('file1', 'Select the Input File',
                accept=c('text/csv','text/comma-separated-values,text/plain','.csv')),
      tags$hr(),
      fileInput('file2', 'Select the UserTopic file',
                accept=c('text/csv','text/comma-separated-values,text/plain','.csv'))

    ),
    mainPanel(
      dataTableOutput('table'),
      downloadButton('OutputFile', 'Download Output File')
    )
  ))
)
Run Code Online (Sandbox Code Playgroud)

服务器端

#server.R
library(shiny)

shinyServer(function(input, output) {

  observe({
    file1 = input$file1
    file2 = input$file2
    if (is.null(file1) || is.null(file2)) {
      return(NULL)
    }
    data1 = read.csv(file1$datapath,header = …
Run Code Online (Sandbox Code Playgroud)

r shiny

6
推荐指数
2
解决办法
4506
查看次数

将图像添加到闪亮动作按钮

我有一个闪亮的动作按钮,但我希​​望显示图像而不是字体.我已经使用标签$按钮作为动作按钮.这会显示一个小灰框.相反,我想显示一个"电源"按钮.

 fluidRow(
      column(4,offset=11,
        tags$button(
        id = "reset_button",
        class="btn action-button"

        ))),
Run Code Online (Sandbox Code Playgroud)

谢谢!

r shiny

6
推荐指数
2
解决办法
5780
查看次数

从SQL中的数组中删除null

想要从Hive / SQL中的数组中删除空值

例如:数组转换为字符串值后为['1',null],则仅应为'1'。

拆分数组我正在使用以下:

concat_ws( ",", array_val)

this gives : 1,null

required output : 1
Run Code Online (Sandbox Code Playgroud)

谢谢您的帮助!

sql arrays hive hiveql

5
推荐指数
1
解决办法
674
查看次数

标签 统计

r ×2

shiny ×2

arrays ×1

hive ×1

hiveql ×1

sql ×1