Error in kable and kableExtra in R Markdown

瘦欲@ 提交于 2019-12-11 16:38:05

问题


I am trying to learn to use kable and kableExtra to generate an html document from a shiny app. The code goes something like this:

orthoInstructions <- special_ortho_table()

kable(orthoInstructions, "html", booktabs = T) %>% 
  kable_styling(full_width = FALSE, position = "center") 

The output depends on the special_ortho_table() in the app and generates a table of varying number of rows but the number of columns are always the same - two.

However, whenever I try to add something more to this to modify the table, altering the column width, or such as described here, or simple changes:

kable(orthoInstructions, "html", booktabs = T) %>% 
  kable_styling(full_width = FALSE, position = "center") %>% column_spec(1, bold = T)

I get the following error:

Quitting from lines 40-49 (report_drugHTML.Rmd) 

Warning: Error in [[: subscript out of bounds
  [No stack trace available]

I am fairly new to coding in general, again, am I missing something obvious?

来源:https://stackoverflow.com/questions/59040243/error-in-kable-and-kableextra-in-r-markdown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!