R Shiny DateRangeInput帮助选择日期

时间:2018-12-10 15:32:42

标签: r shiny

library(shiny)
ui <- fluidPage(dateRangeInput(inputId = "turkat$time",format = "yyyy-mm- 
dd",min=min(turkat$time),max = max(turkat$time),start="1990-01- 
01",separator="-" ),
            headerPanel("Earthquake"),

            mainPanel(plotOutput("map"))

)

server <- function(input, output) {
 turkat <-  reactive({
 turkat[,turkat$time]
 })
 output$map<-renderPlot({ par(mar=c(5.1, 4.1, 3.1, 2.1))

    plot(turkiye, axes=TRUE,ylim=c(38,42),xlim=c(26,42))
    points(turkat$longitude,turkat$latitude,pch=15,cex="0.5",col="green")

     })
   }

    shinyApp(ui = ui, server = server)

我想绘制用户选择的具有R光泽的日期之间的地震图。我是新手,请继续尝试此错误。我也想通过使用cex参数根据幅度绘制它。我该怎么办?

  

标签%AND%标签$ label(class =“ control-label”,for =   controlName ,:缺少参数“标签”,没有默认值

预先感谢

1 个答案:

答案 0 :(得分:0)

尝试一下:

library(shiny)
ui <- fluidPage(
  dateRangeInput("turkat_time",format = "yyyy-mm-dd",min=min(turkat$time),max = max(turkat$time),start="1990-01-01",separator="-" ),
  headerPanel("Earthquake"),
  mainPanel(plotOutput("map"))
)

server <- function(input, output) {

  myturkat <- reactive({
    turkat[,input$turkat_time]
  })

  output$map <- renderPlot({ 
    req(myturkat())

    par(mar=c(5.1, 4.1, 3.1, 2.1))
    plot(myturkat(), axes=TRUE,ylim=c(38,42),xlim=c(26,42))
    points(myturkat()$longitude,myturkat()$latitude,pch=15,cex="0.5",col="green")
  })

}

shinyApp(ui = ui, server = server)