【问题标题】:R shiny - working with histogram parameters in reactive({}) settingR闪亮 - 在反应({})设置中使用直方图参数
【发布时间】:2016-05-29 10:36:21
【问题描述】:

我试图在闪亮的应用程序中将我的反应直方图的 x 轴限制设置为恒定。例如,无论我模拟什么数据,我总是希望在 0 到 3000 之间有 200 个中断(任何超过 3000 或低于 0 的频率都应该被截断)。

有没有简单的方法来完成这项工作?

我根据here的想法尝试了以下方法:

histSims <- reactive({
        #return
        hist(beanSims()[beanSims() > 1 & beanSims < 3000],
             breaks = 200,
             prob = T)

紧随其后

output$plot4 <- renderPlot({
        plot(histSims()                 
      ))
    })

但我明白了

Error: comparison (3) is possible only for atomic and list types

【问题讨论】:

    标签: r plot shiny histogram


    【解决方案1】:

    这段代码怎么样:

    histSims <- reactive({
                #return
                beanSims_local<-beanSims()
                beanSims_local<-beanSims_local[beanSims_local> 1 & beanSims_local< 3000]
                hist(beanSims_local,
                     breaks = 200,
                     prob = T)
    

    【讨论】:

      猜你喜欢
      • 2019-03-07
      • 1970-01-01
      • 1970-01-01
      • 2019-02-15
      • 2019-06-15
      • 1970-01-01
      • 2019-10-12
      • 2020-05-17
      • 1970-01-01
      相关资源
      最近更新 更多