Hello,
I have this relatively simple problem I hope I can get a solution for. I want one datatable
that's the combination of the two tables below. The values that should show on the table should come from df_value
while the conditional formatting for each cell should be based on df_count
. If the cell value in df_count
is less than 10 then the corresponding cell should be highlted red on the final datatable
output while showing the value from the second table.
library(DT)
df_count <- data.frame(
A = c(27L, 2L, 46L, 30L, 34L, 1L, 48L, 1L, 8L, 17L, 17L, 8L, 25L, 7L),
B = c(47L,16L,44L,9L,42L,39L,36L,8L,32L,
33L,40L,5L,19L,33L),
C = c(18L,32L,41L,2L,42L,29L,4L,12L,50L,
41L,31L,19L,16L,35L),
D = c(42L,31L,44L,41L,2L,28L,6L,31L,22L,
15L,31L,21L,27L,1L),
E = c(47L,17L,15L,5L,34L,12L,27L,24L,4L,
10L,1L,12L,12L,50L)
)
#datatable(df_count)
df_value <- data.frame(
A = c(95L,69L,4L,68L,3L,90L,47L,50L,
72L,61L,23L,74L,40L,27L),
B = c(47L,17L,54L,3L,79L,9L,34L,20L,
32L,56L,48L,44L,54L,80L),
C = c(69L,96L,79L,56L,73L,5L,45L,25L,
57L,38L,60L,30L,18L,79L),
D = c(37L,41L,49L,61L,41L,7L,52L,99L,
18L,27L,100L,91L,46L,19L),
E = c(42L,18L,41L,15L,53L,49L,3L,34L,
85L,78L,10L,44L,70L,91L)
)
#datatable(df_value)
Created on 2020-10-12 by the reprex package (v0.3.0)