remove dplyr from dependencies
diff --git a/docs/awesome_table_in_html.html b/docs/awesome_table_in_html.html
index 40f4a07..2aa9ce2 100644
--- a/docs/awesome_table_in_html.html
+++ b/docs/awesome_table_in_html.html
@@ -4857,20 +4857,22 @@
<p>Currently, <code>cell_spec</code> supports features including bold, italic, monospace, text color, background color, align, font size & rotation angle. More features may be added in the future. Please see function documentations as reference.</p>
<div id="conditional-logic" class="section level2">
<h2>Conditional logic</h2>
+<blockquote>
+<p><strong>Key Update: Again, as said before, if you are using kableExtra 1.2+, you are now recommended to used <code>column_spec</code> to do conditional formatting</strong>.</p>
+</blockquote>
<p>It is very easy to use <code>cell_spec</code> with conditional logic. Here is an example.</p>
-<pre class="r"><code>library(dplyr)
-mtcars[1:10, 1:2] %>%
- mutate(
- car = row.names(.),
- mpg = cell_spec(mpg, "html", color = ifelse(mpg > 20, "red", "blue")),
- cyl = cell_spec(cyl, "html", color = "white", align = "c", angle = 45,
- background = factor(cyl, c(4, 6, 8),
- c("#666666", "#999999", "#BBBBBB")))
- ) %>%
- select(car, mpg, cyl) %>%
- kbl(format = "html", escape = F) %>%
- kable_styling("striped", full_width = F)</code></pre>
-<table class="table table-striped" style="width: auto !important; margin-left: auto; margin-right: auto;">
+<pre class="r"><code>cs_dt <- mtcars[1:10, 1:2]
+cs_dt$car = row.names(cs_dt)
+row.names(cs_dt) <- NULL
+cs_dt$mpg = cell_spec(cs_dt$mpg, color = ifelse(cs_dt$mpg > 20, "red", "blue"))
+cs_dt$cyl = cell_spec(
+ cs_dt$cyl, color = "white", align = "c", angle = 45,
+ background = factor(cs_dt$cyl, c(4, 6, 8), c("#666666", "#999999", "#BBBBBB")))
+cs_dt <- cs_dt[c("car", "mpg", "cyl")]
+
+kbl(cs_dt, escape = F) %>%
+ kable_paper("striped", full_width = F)</code></pre>
+<table class=" lightable-paper lightable-striped" style="font-family: "Arial Narrow", arial, helvetica, sans-serif; width: auto !important; margin-left: auto; margin-right: auto;">
<thead>
<tr>
<th style="text-align:left;">
@@ -4997,23 +4999,34 @@
</tr>
</tbody>
</table>
+<pre class="r"><code># You can also do this with dplyr and use one pipe from top to bottom
+# library(dplyr)
+# mtcars[1:10, 1:2] %>%
+# mutate(
+# car = row.names(.),
+# mpg = cell_spec(mpg, "html", color = ifelse(mpg > 20, "red", "blue")),
+# cyl = cell_spec(cyl, "html", color = "white", align = "c", angle = 45,
+# background = factor(cyl, c(4, 6, 8),
+# c("#666666", "#999999", "#BBBBBB")))
+# ) %>%
+# select(car, mpg, cyl) %>%
+# kbl(format = "html", escape = F) %>%
+# kable_styling("striped", full_width = F)</code></pre>
</div>
<div id="visualize-data-with-viridis-color" class="section level2">
<h2>Visualize data with Viridis Color</h2>
<p>This package also comes with a few helper functions, including <code>spec_color</code>, <code>spec_font_size</code> & <code>spec_angle</code>. These functions can rescale continuous variables to certain scales. For example, function <code>spec_color</code> would map a continuous variable to any <a href="https://CRAN.R-project.org/package=viridisLite">viridis color palettes</a>. It offers a very visually impressive representation in a tabular format.</p>
-<pre class="r"><code>iris[1:10, ] %>%
- mutate_if(is.numeric, function(x) {
+<pre class="r"><code>vs_dt <- iris[1:10, ]
+vs_dt[1:4] <- lapply(vs_dt[1:4], function(x) {
cell_spec(x, bold = T,
color = spec_color(x, end = 0.9),
font_size = spec_font_size(x))
- }) %>%
- mutate(Species = cell_spec(
- Species, color = "white", bold = T,
- background = spec_color(1:10, end = 0.9, option = "A", direction = -1)
- )) %>%
- kbl(escape = F, align = "c") %>%
- kable_styling(c("striped", "condensed"), full_width = F)</code></pre>
-<table class="table table-striped table-condensed" style="width: auto !important; margin-left: auto; margin-right: auto;">
+})
+vs_dt[5] <- cell_spec(vs_dt[[5]], color = "white", bold = T,
+ background = spec_color(1:10, end = 0.9, option = "A", direction = -1))
+kbl(vs_dt, escape = F, align = "c") %>%
+ kable_classic("striped", full_width = F)</code></pre>
+<table class=" lightable-classic lightable-striped" style="font-family: "Arial Narrow", "Source Sans Pro", sans-serif; width: auto !important; margin-left: auto; margin-right: auto;">
<thead>
<tr>
<th style="text-align:center;">
@@ -5206,7 +5219,6 @@
</tr>
</tbody>
</table>
-<p>In the example above, I’m using the <code>mutate</code> functions from <code>dplyr</code>. You don’t have to use it. Base R solutions like <code>iris$Species <- cell_spec(iris$Species, color = "red")</code> also works.</p>
</div>
<div id="text-specification" class="section level2">
<h2>Text Specification</h2>
@@ -5312,19 +5324,21 @@
<h2>Integration with <code>formattable</code></h2>
<p>You can combine the good parts from <code>kableExtra</code> & <code>formattable</code> together into one piece. Read more at <a href="http://haozhu233.github.io/kableExtra/use_kableExtra_with_formattable.html" class="uri">http://haozhu233.github.io/kableExtra/use_kableExtra_with_formattable.html</a></p>
<pre class="r"><code>library(formattable)
-mtcars[1:5, 1:4] %>%
- mutate(
- car = row.names(.),
- mpg = color_tile("white", "orange")(mpg),
- cyl = cell_spec(cyl, angle = (1:5)*60,
- background = "red", color = "white", align = "center"),
- disp = ifelse(disp > 200,
- cell_spec(disp, color = "red", bold = T),
- cell_spec(disp, color = "green", italic = T)),
- hp = color_bar("lightgreen")(hp)
- ) %>%
- select(car, everything()) %>%
- kbl(escape = F) %>%
+ft_dt <- mtcars[1:5, 1:4]
+ft_dt$car <- row.names(ft_dt)
+row.names(ft_dt) <- NULL
+ft_dt$mpg <- color_tile("white", "orange")(ft_dt$mpg)
+ft_dt$cyl <- cell_spec(ft_dt$cyl, angle = (1:5)*60,
+ background = "red", color = "white", align = "center")
+ft_dt$disp <- ifelse(
+ ft_dt$disp > 200,
+ cell_spec(ft_dt$disp, color = "red", bold = T),
+ cell_spec(ft_dt$disp, color = "green", italic = T)
+)
+ft_dt$hp <- color_bar("lightgreen")(ft_dt$hp)
+ft_dt <- ft_dt[c("car", "mpg", "cyl", "disp", "hp")]
+
+kbl(ft_dt, escape = F) %>%
kable_styling("hover", full_width = F) %>%
column_spec(5, width = "3cm") %>%
add_header_above(c(" ", "Hello" = 2, "World" = 2))</code></pre>
@@ -6452,7 +6466,7 @@
1
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
@@ -6484,7 +6498,7 @@
5
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
@@ -6492,7 +6506,7 @@
6
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
@@ -6500,7 +6514,7 @@
7
</td>
<td style="text-align:center;">
-1
+0
</td>
</tr>
<tr>
@@ -6511,7 +6525,7 @@
8
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
@@ -6527,7 +6541,7 @@
10
</td>
<td style="text-align:center;">
-1
+0
</td>
</tr>
<tr>
@@ -6541,7 +6555,7 @@
11
</td>
<td style="text-align:center;">
-1
+0
</td>
</tr>
<tr>
@@ -6568,7 +6582,7 @@
14
</td>
<td style="text-align:center;">
-1
+0
</td>
</tr>
<tr>
@@ -6576,7 +6590,7 @@
15
</td>
<td style="text-align:center;">
-1
+0
</td>
</tr>
</tbody>