javascript - Conditional Formatting datatable DT R -


i big fan of dt package in r. want replicate excel conditionally formatted tables have, finding difficult access styling features.

specifically, love able create function allows user call row/column of datatable , apply conditional formmating it, how done in excel. added feature novice r users myself, , speed process else. unlike heat map, conditional formatting important when row/columns not of same type, therefore need each 1 individually. nice able speficify high , low value option markers.

i see can create breaks, in follow example on this page

    # create 19 breaks , 20 rgb color values ranging white red brks <- quantile(df, probs = seq(.05, .95, .05), na.rm = true) clrs <- round(seq(255, 40, length.out = length(brks) + 1), 0) %>%   {paste0("rgb(255,", ., ",", ., ")")} datatable(df) %>% formatstyle(names(df), backgroundcolor = styleinterval(brks, clrs)) 

but not sure how apply individual rows, though seems can call them name, seen here via formatstyle() , background color, still dont have shaded gradient , need know row/column name, bit much

any creating custom function big r datatable community imo.

you can try this:

 # create 19 breaks , 20 hex color values ranging red green using white around median brks <- quantile(df, probs = seq(.05, .95, .05), na.rm = true) colfunc <- colorramppalette(c("red","white","green")) clrs <- colfunc(length(brks) + 1) datatable(df) %>% formatstyle(names(df), backgroundcolor = styleinterval(brks, clrs)) 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -