[英]R Markdown kable table using $ sign in column name for html output
I'm wanting to include the units in my column description for a kable table in R Markdown with html output. Basically for each cost I want 'Cost Min ($k)', 'Cost Mode ($k)' and 'Cost Max ($k)' as 3 of my column names.我想在 R Markdown 和 html output 中的 kable 表的列描述中包含这些单位。基本上对于每个成本,我想要“Cost Min ($k)”、“Cost Mode ($k)”和“Cost Max” ($k)' 作为我的列名中的 3 个。
It works fine for my first table but then for my second it is outputting it with strange formatting and not reading each column name correctly.它适用于我的第一个表,但对于我的第二个表,它以奇怪的格式输出它并且没有正确读取每个列名。
My code is as follows:我的代码如下:
Summary<- matrix(c(0.90,0.99,1000,3000,5000,0.90,0.99,1000,3000,5000,0.30,0.60,500,750,1000), ncol=5,byrow=TRUE)
colnames(Summary)<-c("Probability Lower","Probability Upper" , "Cost Min ($k)" , "Cost Mode ($k)" , "Cost Max ($k)")
rownames(Summary)<-c("Start", "Current", "Target")
SummaryTable<-as.table(Summary)
knitr::kable(SummaryTable, format = "html") %>%
kableExtra::kable_styling(SummaryTable,bootstrap_options = "bordered")
Any help would be much appreciate as I would like all my tables to look like the one that is working.任何帮助将不胜感激,因为我希望我的所有表格看起来都像正在工作的表格。
Laura劳拉
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.