【问题标题】:The problem with producing the colour in one of the column of the table produced by the formattable package在 formattable 包生成的表格的一列中产生颜色的问题
【发布时间】:2020-06-30 16:02:29
【问题描述】:

我之前应用了这个代码,结果并不完全符合预期,因为matching_probability 部分没有显示颜色图块。 我无法添加图片,否则我会显示。

formattable(df, 
            align = c("l","c","c","c","c","c","r"), 
            list(`Locus_number` = formatter(
                "span", style = ~ style(color = "grey",font.weight = "bold")), 
                `PIC`= color_tile(customGreen, customGreen0),
                `Matchin_Probability`= color_tile('white', 'orange'),
                `Power_of_Discrimination`= color_tile(customGreen, customGreen0),
                `Power_of_Exclusion`= color_tile(customGreen, customGreen0),
                `Paternity_Index` = color_bar(customRed)
            ))

【问题讨论】:

    标签: r formattable aesthetics


    【解决方案1】:

    我过去也遇到过同样的问题,可能您在特定列中有一些 inf 值,只需将其替换为 0 或 NA

    df[mapply(is.infinite, df)] <- NA
    

    【讨论】:

    • 你能添加data.frame吗,看起来其中一个值不正确
    • 我发现了我提到的一个变量的名称错误的问题,这就是它不只编译该列的原因。
    猜你喜欢
    • 1970-01-01
    • 2018-10-21
    • 2011-05-19
    • 1970-01-01
    • 2016-06-15
    • 1970-01-01
    • 2020-06-17
    • 2013-08-13
    • 2020-02-12
    相关资源
    最近更新 更多