我正试图用R中的pdf来编织一个观星台,而我对其中一个细胞中的一个符号(&)有一个问题。我想保留这个符号(因为它是一个商业名称,影响订单)。
下面是我使用的代码:
```{r results='asis'}old_df <- bus_df %>%
变异(char_date= as.character(clean_start_date)) %>%
变异(business_name= str_replace_all(business_name,"&","\\&")) %>%
选择(business_name,char_date) %>%
切片(1:5)
old_df %>%
观星者(summary=FALSE,header=FALSE,title=“最古老的5大忙人”)
数据的第一行:
建筑材料有限公司1921-01-01
错误:
>! Extra alignment tab has been changed to \cr.
><recently read> \endtemplate
>
>l.217 1 & A & A BUILDING MATERIAL CO &
>
>pandoc: Error producing PDF from TeX source
>Error: pandoc document conversion failed with error 43
>Execution halted我排除了试图将转义字符添加到符号中的代码,但是任意数量的斜杠(最多6)都会返回一个错误。1、3和5破坏代码块,而2、4和6破坏编织。当4和6插入斜杠('\&')时,2不改变单元格(残留物&)中的字符,但是斜杠破坏了针织物。
用斜杠:
数据的第一行:
A&A建材公司1921-01-01
错误:
>! Extra alignment tab has been changed to \cr.
><recently read> \endtemplate
>
>l.217 ...\textbackslash & A BUILDING MATERIAL CO &
>
>pandoc: Error producing PDF from TeX source
>Error: pandoc document conversion failed with error 43
>Execution halted如果你需要更多细节,请告诉我!
谢谢!
发布于 2016-11-04 02:29:06
虽然stargazer很适合格式化模型输出,但是xtable包提供了您想要的data.frames格式化功能,等等。下面的代码块应该可以做到这一点。
```{r results='asis'}old_df <- bus_df %>%
变异(char_date= as.character(clean_start_date)) %>%
选择(business_name,char_date) %>%
切片(1:5)
xtable(old_df)
https://stackoverflow.com/questions/40370791
复制相似问题