Search code examples
rr-markdownkableextra

Extra Alignment Error with KableExtra in R-markdow


I am relitively new to R and R-Markdown. I am receiving an error message of

! Extra alignment tab has been changed to \cr. \endtemplate

In Table 4. I do not know what the error is telling me, and I don't know how to fix it. The code in Table 4 is the same format as the other tables. I have spent three days on this, I understand that this my be a simple fix, but I am at a loss.

I have added and subtracted l's and c's from the alignment clause, I have constructed a randomly generated data set, and Table 4 will run as it should. Leading me to believe that there is a problem with that specific column of data.

licen_area<-USC_cola%>%
  group_by(Licen_area, .drop=F)%>%
  summarise(count=n())%>%
  ungroup()%>%
  mutate(perc = round((count/sum(count)*100),2))
kable(licen_area,"latex",booktabs=T,align="lcc",
      col.names=linebreak(c("Licensure\nArea","Count", "\\%"),align="c"),row.names=F, escape=F)

code

data

Any solutions or workarounds will be most helpful!


Solution

  • There was a special character in the data. Once that was removed it worked fine!