Search code examples
rr-markdownkable

How to fix Kable table bug in R markdown?


I manually created this Dataset from 2 vectors:

Classe <- c("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q")
Renda <- c("Nenhuma","Até R$998", "R$ 998,01 à R$ 1.497","R$ 1.497,01 à R$ 1.996","R$ 1.996,01 à R$ 2.495","R$ 2.495,01 à R$ 2.994","R$ 2.994,01 à R$ 3.992","R$ 3.992,01 à R$ 4.990","R$ 4.990,01 à R$ 5.988","R$ 5.988,01 à R$ 6.986","R$ 6.986,01 à R$ 7.984","R$ 7.984,01 à R$ 8.982","R$ 8.982,01 até R$ 9.980","R$ 9.980,01 até R$ 11.976","R$ 11.976,01 à R$ 14.970","R$ 14.970,01 à R$ 19.960","Mais de R$ 19.960")

DF:

dfRenda <- data.frame(Classe,Renda)

Both are 17 rows. When I call View it is displayed perfectly

But when I call the Kable function so I can enhace the visuals I keep getting this weird bug where the C label is missing but is merged into another column

Bug in Rmarkdown:

enter image description here


Solution

  • Setting format to "simple" works fine:

    knitr::kable(dfRenda, format = "simple")
    

    enter image description here