ErrantBard ErrantBard - 3 months ago 22
R Question

Kable and pandoc.table takes only the first six rows

I'm trying to build a table either using

and have problems getting them to print all 10 rows in my table, atm they both only prints the first six. While I moved to write the table manually, which works, it would be nice to know what's wrong with my code. I haven't seen anything to suggest that 6 rows are the limit, so my code should be workning? Anyone know why it doesn't? If I subset the dt I can print the last 4 as well so maybe 6 rows are a limit. Code below:


count.mark <- 35

dt.tbl1 <- data.table(Var = c("Geo", "A", "A",
"Cust", "A",
"Ins", "A",
"Vei", "A",
RangeR = c("A1", "S1", "T1",
"Com", "Pri",
"T", "B",
"Pa", "Pe",
paste("A1 - A99 (",
count.mark, ")", sep="")
pandoc.table(head(dt.tbl1), justify = c("left", "centre"))
kable(head(dt.tbl1), justify = c("left", "centre"))


That's because you're using head(dt.tbl1), which by default shows the first six rows. You should just do, e.g.

pandoc.table(dt.tbl1, justify = c("left", "centre"))