flextable conditional formatting with "< ="

Can anyone suggest why I am having a problem with "greater than" in {flextable}? I assume I'm missing something obvious but what?


DT  <- data.table(aa = LETTERS[1:7], bb = c("12", "4", "<5", "<2", "<0.5", "15", "20"), 
                  cutoff = c(6, 4, 5, 7, 11, 7, 20 ))

DT1  <- DT[- grep("<", bb),]
DT1[, bb := as.numeric(bb)]

# Equality  work

tb1 <- flextable(DT1, col_keys = c("aa", "bb"))
tb1  %>%  bold(~ bb == cutoff, 2) 

# "Greater than" does  not work
tb2 <- flextable(DT1, col_keys = c("aa", "bb"))
tb2  %>%  bold(~ bb < cutoff, 2) 

your example data simply doesnt have a row for which the bb is strictly less than the cutoff value.

i.e. you have said 'greater than' doesnt work; but your code implements 'less than'

I knew I was doing something really stupid, I just had not realised how stupid!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.