我有下面的代码,它允许接受 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) 我有一个闪亮的动作按钮,但我希望显示图像而不是字体.我已经使用标签$按钮作为动作按钮.这会显示一个小灰框.相反,我想显示一个"电源"按钮.
fluidRow(
column(4,offset=11,
tags$button(
id = "reset_button",
class="btn action-button"
))),
Run Code Online (Sandbox Code Playgroud)
谢谢!
想要从Hive / SQL中的数组中删除空值
例如:数组转换为字符串值后为['1',null],则仅应为'1'。
拆分数组我正在使用以下:
concat_ws( ",", array_val)
this gives : 1,null
required output : 1
Run Code Online (Sandbox Code Playgroud)
谢谢您的帮助!