如何从xtable输出中删除{}

时间:2017-07-31 17:45:51

标签: r r-markdown

我有这个降价,

---
title: "TEST"
date: "`r date()`"

header-includes:
   - \usepackage{longtable}
   - \usepackage[table]{xcolor}
   - \usepackage{colortbl}
   - \usepackage[utf8]{inputenc}
   - \usepackage{graphicx}
   - \usepackage{wrapfig}
output:
  pdf_document:
    fig_caption: yes
    fig_height: 6
    fig_width: 7
    highlight: zenburn
    number_sections: yes
    toc: yes
    toc_depth: 4
keep_tex: yes
tables: yes
fontsize: 15
---

```{r message=FALSE, results = 'asis', echo=FALSE, warning=FALSE, fig.width=12, fig.height=10}
library(xtable)

glossary2<-data.frame(names=letters[1:4],definition=c("very long long long text very long long long text very long long long text very long long long text","very long long long long long text","very long long long long long long text","very long long long text"),include=c(NA,"YES",NA,"NO"))
glossaryprin<-xtable(glossary2,label="tab:codebook",caption="glossary")

align(glossaryprin)<-"lp{2in}p{3in}p{1in}" #here is the change
print(glossaryprin,tabular.environment="longtable",floating=FALSE,size="\\fontsize{30pt}{10pt}\\selectfont")
```

我可以在xtable输出表之外删除{和}吗?

1 个答案:

答案 0 :(得分:0)

df <- gsub('[{}]', '', df)

这是你正在寻找的吗?