1

在 R 中使用 Xlsx 包,有没有办法根据另一个单元格的特定文本突出显示 excel 单元格?即,如果 C10 = "Cat",则突出显示 D10 和 E10。我看过很多关于数值的帖子。我想根据文本值和接下来的两个相邻列进行格式化。

工作示例

library(xlsx)

setwd('C:/Users/WORKING DIRECTORY')

animals <- c("Cat","Mice","Dog","Bird","Cat","Cat")
colors <- c("Grey","White","Black","Blue","Black","Orange")
store <- c("Pet Shop","Online","Pets Mart","Walmart","Online","Pets Mart")

df <- cbind(animals,colors,store)

write.xlsx(df, file ="test_test.xlsx",row.names = FALSE, sheetName= "Data")
4

0 回答 0