高亮显示pval低于0.05的行

时间:2018-06-22 12:16:22

标签: r shiny

我想突出显示pvalue小于0.05的行 下面的代码是我渲染表格的方式。

我的桌子是经典的方差桌子。 pvalue是列“ Pr(> F)”

output$tablepermanova <- DT::renderDataTable(
       values$anovatable, options = list(orderClasses = TRUE),
       caption="Analysis of variance",
       filter = 'top'   )

1 个答案:

答案 0 :(得分:2)

您可以将SELECT som.Customer , sod.MStockCode , sod.MPrice , som.EntrySystemDate , sat.Sequence2 , sat.SalesValue , sat.TrnMonth , NULLIF (sat.SalesValue, 0) / NULLIF (sod.MPrice, 0) AS Unit , bos.ParentPart , bos.Component , bos.QtyPer , NULLIF (sat.SalesValue, 0) / NULLIF (sod.MPrice, 0) * bos.QtyPer AS QtyNeeded FROM dbo.SorDetail AS sod INNER JOIN dbo.SorMaster AS som ON sod.SalesOrder = som.SalesOrder INNER JOIN (SELECT SorMaster.Customer, SorDetail.MStockCode, MAX(SorMaster.EntrySystemDate) as max_date FROM SorDetail INNER JOIN SorMaster ON SorDetail.SalesOrder = SorMaster.SalesOrder GROUP BY Customer, MStockCode ) b ON sod.MStockCode = b.MStockCode AND som.Customer = b.Customer AND som.EntrySystemDate = b.max_date LEFT JOIN dbo.SalTargets AS sat ON sod.MStockCode = sat.Sequence2 INNER JOIN dbo.BomStructure AS bos ON sod.MStockCode = bos.ParentPart WHERE (sod.MStockCode <> '') AND (sat.SequenceType = 'SC') formatStyle结合使用,请参见一些示例here

我们没有您的数据,但是下面的styleInterval数据集给出了一个工作示例,其中突出显示了少于(或等于)5个气缸的汽车的所有行。用包含mtcars的列名替换'cyl'并用5替换0.05即可解决问题。

希望这会有所帮助!

library(shiny)

ui <- fluidPage(
  DT::dataTableOutput('table')
)
server <- function(input, output, session) {

  output$table <- DT::renderDataTable(
    DT::datatable(mtcars) %>% formatStyle(
        'cyl',
        target = 'row',
        backgroundColor = styleInterval(5, c('orange','white'))
      )
  )
}

shinyApp(ui,server)