相关疑难解决方法(0)

闪亮 - 自定义警告/错误消息?

当所需数据为空时,如何打印自定义警告/错误消息?

例如,在我的 server.R 中,我有下面的代码,

output$plot = renderPlot({

      # Sites.
      site1 = input$site1

      # Prepare SQL query.
      query <- "SELECT * FROM datatable
                  WHERE sites.id = 'SITE1'
                  "

      # Match the pattern and replace it.
      query <- sub("SITE1", as.character(site1), query)

      # Store the result in data.
      data = dbGetQuery(DB, query)

      if (is.na(data) || data == '') {

        # print error/ warning message
        "sorry, no data is found."

      } else {

       # plot the data
       dens <- density(data$particles, na.rm = …
Run Code Online (Sandbox Code Playgroud)

r shiny

3
推荐指数
1
解决办法
4724
查看次数

标签 统计

r ×1

shiny ×1