I’m trying to make a copy of a visualisation of a table from Excel in R so that it can be automated as the original version is very labour intensive. From a google it seems formattable is the best package to achieve this, but I can’t find any documentation for adding lines between columns.
Does anyone have experience with this package, and know how to do that?
How do you add vertical gridlines between columns in the formattable R package?
Hey! Not had much experience with the formattable package and similarly, I’m struggling to find documentation on adding column lines in.
Have you tried using Kable extra package? Again, not something I’ve tried but there is a scope for automation (quick Google led to this), and there is an ability to add column lines in with something like…
kable() %>%
column_spec (1:7,border_left = T, border_right = T) %>%
kable_styling()
it seems formattable is the best package to achieve this, but I can’t find any documentation for adding lines between columns.
Alternatively, you can use the gt package. Its a very flexible package with a range of customisation options!
Have you tried using Kable extra package?
Hey Liz,
That was the first package I looked at, as it seemed to have some of the best documentation, but there’s other functionality it doesn’t have, such as conditional formatting!
it seems formattable is the best package to achieve this, but I can’t find any documentation for adding lines between columns.
Alternatively, you can use the gt package. Its a very flexible package with a range of customisation options!
Yeah GT is what i’m going to go with, it seems to have all the good things about formattable, but with more options as well! Cheers Wes
Hi Ben,
If you’re making a html table, the DT package allows gridlines with class = "cell-border and conditional formatting with formatStyle. However, it's not very good if you want to export the table as a pdf.
Reply
Login to the community
No account yet? Create an account
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.