1
grid %>%
  mutate_if(is.numeric, function(x) {format(x, digits = 2, big.mark = ",", 
decimal.mark = ".")}) %>%
  mutate(
seven_day_unique_viewers = cell_spec(seven_day_unique_viewers, italic = (Sys.Date() - as.Date(grid$debut_date, "%B %d, %Y") < 7)),
seven_day_rating = cell_spec(seven_day_rating, italic = (Sys.Date() - as.Date(grid$debut_date, "%B %d, %Y") < 7))
  ) %>%
kable(row.names=FALSE, col.names=col_names, align='c',format.args = 
list(decimal.mark = ".", big.mark = ",", justify = c("centre")),escape=TRUE) %>%
 kable_styling(bootstrap_options = c("bordered", "hover","condensed"), 
full_width = F,font_size = 13) %>%
  column_spec(2, width = "11em") %>%
  column_spec(3, width = "10em") %>%
  row_spec(row_highlight, background = "yellow")

不知道这里发生了什么,任何建议将不胜感激。我确认我的 if 条件评估正确。

4

0 回答 0