I would like to mark (for instance bold) the last row in Data Table generated using DT package. Let's say we have a table with the iris dataset:
library(DT)
datatable(iris)
Results:
So we have 150 rows and I would like to bold only 150 row.
Edit: @BigDataScientist let me clear this. I have this:
output$tbl <-
DT::renderDataTable(
data() %>% # let's say iris data - it doesn't matter
bind_rows(summarise(data(), SUM = "SUM", A = sum(A), B = sum(B),
C = sum(C), D = sum(D),
E = sum(E), F = sum(F))) %>%
mutate(SUM = rowSums(.[2:6])),
extensions = 'Buttons',
options = list(
dom = 'Blfrtip',
lengthMenu = list(c(-1, 5, 10, 15, 20, 25), c('All', '5', '10', '15', '20', '25')),
buttons = list('copy',
list(extend = 'excel',
filename = 'report'),
list(extend = 'pdf',
filename = 'report'),
'print'),
rownames = FALSE,
server = FALSE
) %>%
formatStyle(
target = "row",
fontWeight = styleEqual(dim(.)[1], "bold")
)
)
So, I would like to add bolding last row; in this case, SUM of columns; to this pipeline, so everything would be in one piece (one pipeline).