我正在尝试使用formattable很棒的包,并获得一个表格,该表格具有在多个列上缩放的百分比和颜色。
这是代码
set.seed(123)
df <- data.frame(id = 1:10,
a = rnorm(10), b = rnorm(10), c = rnorm(10))
df$a <- percent(df$a)
df$b <- percent(df$b)
df$c <- percent(df$c)
table_with_percent_but_color_not_scaled <- formattable(df, list(a = color_tile("transparent", "pink")
, b= color_tile("transparent", "pink")
, c= color_tile("transparent", "pink")))
table_with_color_scaled_but_not_percent <- formattable(df, list(area(col = 2:4) ~ color_tile("transparent","pink")))
Run Code Online (Sandbox Code Playgroud)
问题是table_with_color_scaled_but_not_percent不要保留百分比格式:
并且table_with_percent_but_color_not_scaled不要保持相同的比例为颜色上色:
理想情况下,我想使用该area功能,因为我的df列数和名称将在最终代码中更改。任何的想法 ?谢谢!
我正在尝试将一个指向 url 的链接放入一个 R 闪亮应用程序content的bs_embed_popover函数变量中
文档说
content: 字符,popover body的内容,可以是HTML
但是,我看到该标签在闪亮的应用程序中显示为普通字符 我缺少什么吗?

library(shiny)
library(bsplus)
library(htmltools)
library(shinydashboard)
# UI
ui <-
dashboardPage(
dashboardHeader(title = "Titles"),
dashboardSidebar(
use_bs_popover(),
selectInput(
inputId = "letter",
label = "Label with popover help",
choices = c("a", "b", "c")
) %>%
shinyInput_label_embed(
shiny_iconlink() %>%
bs_embed_popover(
title = "Letter", content = paste0("Choose a favorite","<a href='www.google.com'> Test link </a>")
, placement ="right"
)
)
),
dashboardBody(
tags$style(HTML('.popover-title {color:black;}
.popover-content {color:black;}
.main-sidebar {z-index:1;}')
)
))
# Server …Run Code Online (Sandbox Code Playgroud)