How do I remove decimal points from N? In other words, I want to keep Mean and Median with 2 decimal places, but present N as integer.
library(dplyr)
library(kableExtra)
# Example Data
df <- data.frame(
stat = rep(c("Mean", "Median", "N"), times = 2),
Y2008 = c(1.122, 1.42, 100, 2.122, 2.42, 200),
Y2009 = c(1.152, 1.92, 250, 2.189, 2.49, 300)
)
# Table with kableExtra
df %>%
rename (` ` = stat) %>%
kable(booktabs = TRUE, digits = 2) %>% pack_rows(
index = c("Group 1" = 3, "Group 2" = 3)
)