I would like to create tables in R for a book project. The tables are quite simple (no colors / graphic elements etc.). However, I need to specify both the font and the maximum width of the tables. The tables should be exported as vector graphics afterwards (preferably pdf or svg). Which package do you recommend for this?
I already know kable, formattable and gt. But with all three I haven't found a good solution to export the final tables as vector graphics (especially with fixed width and without losing CSS elements like fonts on export).
Thanks for your advice.
CodePudding user response:
If you use the "save as image" tool from the plot windows in Rstudio, you have the choice to save the image in tiff or svg, and to choose the exportation size. You can also use "save as PDF".
Hope it's help,
Claire
CodePudding user response:
Do you wanna try to save as kable using kableextra see sample below.
library(kableExtra)
kable(mtcars[1:5, ], "html") %>%
kable_styling("striped") %>%
row_spec(1, color = "red") %>%
save_kable("inst/test.pdf")