【问题标题】:R shiny table with plots inside the tableR 闪亮的桌子,桌子内有地块
【发布时间】:2021-04-19 20:16:27
【问题描述】:

我正在开发一个闪亮的 R 应用程序,理想情况下,我需要准确地完成这里所做的事情:

更具体地说,我有股票开盘价、收盘价、最高价、最低价数据的数据框,我需要复制“范围”列中附加图像中显示的内容。 我知道我应该附上一些代码,但事实是,我找不到任何接近我在网上问的东西。 一个示例数据框是:

df = data.frame(STOCK=c("IBM","MSFT","FB"),  OPEN=c(100,90, 80), CLOSE=c(102, 85, 82), LOW=c(99,81,78), HIGH=c(105, 91, 88))

然后,我不知道从这里做什么。有什么建议?谢谢

【问题讨论】:

    标签: r shiny datatable shinydashboard


    【解决方案1】:

    您可以按照本指南使用自定义渲染

    https://glin.github.io/reactable/articles/examples.html#custom-rendering-1

    library(dplyr)
    library(sparkline)
    
    data <- chickwts %>%
      group_by(feed) %>%
      summarise(weight = list(weight)) %>%
      mutate(boxplot = NA, sparkline = NA)
    
    reactable(data, columns = list(
      weight = colDef(cell = function(values) {
        sparkline(values, type = "bar", chartRangeMin = 0, chartRangeMax = max(chickwts$weight))
      }),
      boxplot = colDef(cell = function(value, index) {
        sparkline(data$weight[[index]], type = "box")
      }),
      sparkline = colDef(cell = function(value, index) {
        sparkline(data$weight[[index]])
      })
    ))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-06-19
      • 2020-10-16
      • 2015-12-30
      • 1970-01-01
      • 2017-12-23
      • 2016-12-23
      • 1970-01-01
      • 2018-06-07
      相关资源
      最近更新 更多