这就是我得到的,但当我运行代码时,我得到Error: object 'Name' not found
.有什么办法可以继续下go 吗?
library(gt)
data <- data.frame(
Name = c("John Doe", "Jane Smith", "Bob Johnson"),
Age = c(30, 25, 35))
highlight_word <- "Doe"
gt(data) |>
tab_style(
locations = cells_body(columns = Name),
style = list(cell_text(color =
ifelse(str_detect(Name, highlight_word), "yellow", "white"))))