Suppose I want to format the dataset mtcars as a kable table
kable(mtcars*100)
I want to add a "," for the after each 1000 in the "hp" column (1,000 instead of 1000), but I do not want "," separator in any other column.
Right now I am using:
kable(mtcars,format.args=list(big.mark=","))
What I want to do is control specifically which columns have the comma delimiter and which do not.
I'm not sure if this is what you want:
library(dplyr)
library(knitr)
df %>%
mutate(across(hp, ~ format(.x, big.mark = ","))) %>%
kable()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With