使用R中的Xlsx包,有没有一种方法可以基于另一个单元格的特定文本来突出显示excel单元格?也就是说,如果C10 =“猫”,则突出显示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")