fix bugs before cran release
diff --git a/vignettes/awesome_table_in_html.Rmd b/vignettes/awesome_table_in_html.Rmd
index a98ae10..843cea5 100644
--- a/vignettes/awesome_table_in_html.Rmd
+++ b/vignettes/awesome_table_in_html.Rmd
@@ -255,6 +255,30 @@
column_spec(8, image = spec_plot(mpg_list, polymin = 5))
```
+There is also a `spec_pointrange` function specifically designed for forest plots in regression tables. Of course, feel free to use it for other purposes.
+
+```{r}
+coef_table <- data.frame(
+ Variables = c("var 1", "var 2", "var 3"),
+ Coefficients = c(1.6, 0.2, -2.0),
+ Conf.Lower = c(1.3, -0.4, -2.5),
+ Conf.Higher = c(1.9, 0.6, -1.4)
+)
+
+data.frame(
+ Variable = coef_table$Variables,
+ Visualization = ""
+) %>%
+ kbl(booktabs = T) %>%
+ kable_classic(full_width = FALSE) %>%
+ column_spec(2, image = spec_pointrange(
+ x = coef_table$Coefficients,
+ xmin = coef_table$Conf.Lower,
+ xmax = coef_table$Conf.Higher,
+ vline = 0)
+ )
+```
+
## Row spec
Similar with `column_spec`, you can define specifications for rows. Currently, you can either bold or italicize an entire row. Note that, similar with other row-related functions in `kableExtra`, for the position of the target row, you don't need to count in header rows or the group labeling rows.
diff --git a/vignettes/awesome_table_in_pdf.Rmd b/vignettes/awesome_table_in_pdf.Rmd
index 0c7791a..043e8a7 100644
--- a/vignettes/awesome_table_in_pdf.Rmd
+++ b/vignettes/awesome_table_in_pdf.Rmd
@@ -283,6 +283,30 @@
column_spec(8, image = spec_plot(mpg_list, polymin = 5))
```
+There is also a `spec_pointrange` function specifically designed for forest plots in regression tables. Of course, feel free to use it for other purposes.
+
+```{r}
+coef_table <- data.frame(
+ Variables = c("var 1", "var 2", "var 3"),
+ Coefficients = c(1.6, 0.2, -2.0),
+ Conf.Lower = c(1.3, -0.4, -2.5),
+ Conf.Higher = c(1.9, 0.6, -1.4)
+)
+
+data.frame(
+ Variable = coef_table$Variables,
+ Visualization = ""
+) %>%
+ kbl(booktabs = T) %>%
+ kable_classic(full_width = FALSE) %>%
+ column_spec(2, image = spec_pointrange(
+ x = coef_table$Coefficients,
+ xmin = coef_table$Conf.Lower,
+ xmax = coef_table$Conf.Higher,
+ vline = 0)
+ )
+```
+
## Row spec
Similar with `column_spec`, you can define specifications for rows. Currently, you can either bold or italicize an entire row. Note that, similar to other row-related functions in `kableExtra`, for the position of the target row, you don't need to count in header rows or the group labeling rows.
@@ -326,7 +350,7 @@
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) %>%
+kbl(cs_dt, booktabs = T, escape = F) %>%
kable_paper("striped", full_width = F)
# You can also do this with dplyr and use one pipe from top to bottom
@@ -355,7 +379,7 @@
})
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") %>%
+kbl(vs_dt, booktabs = T, escape = F, align = "c") %>%
kable_classic("striped", full_width = F)
# Or dplyr ver
# iris[1:10, ] %>%