I'm having an error when apply conditional formatting. I want to color red or highlight red the values in the last column that are higher than the column before. It's not a fixed column since I add a new column each time I run the code.
library(readxl)
library(openxlsx)
file <- read_excel("path", col_names = TRUE)
posStyle <- createStyle(fontColour = rgb(1,0,0))
conditionalFormatting(file, cols = file[,ncol(file)], rows = 2:85, file[,ncol(file)]>file[,ncol(file) -1],
style = posStyle)
When i'm running it I get this error: Error in Encoding(v) : a character vector argument expected
Activity | Count | State | Count 2 | Count 3 |
---|---|---|---|---|
xx | Pending | 2 | 1 | 4 |
xx | Pending | 2 | 3 | 2 |
I want for example the number 2 on count 3 to be red since is less than number 3 on count 2.
WHat does it means in this case?