title: RMarkdown not printing Chinese characters in graphs
body: <pre><code>---
  title: 
  
  output: 
   pdf_document:
      latex_engine: xelatex
  
  fontsize: 11pt
  #mainfont: Calibri
  classoption: letter
  geometry: left=0.5in, right=0.5in, top=0.6in, bottom=1.25in
  subparagraph: yes
  
  header-includes:
  - \usepackage[UTF8]{ctex}
  - \usepackage{setspace}
  - \usepackage{tocloft}
  - \usepackage{anyfontsize}
  - \usepackage{fancyhdr}
  - \usepackage{fontspec}
  - \usepackage{sectsty}
  - \sectionfont{\huge}
  - \subsectionfont{\fontsize{14}{16.8}\selectfont}
  - \pagestyle{fancy}
  
  - \renewcommand{\headrulewidth}{0pt}
  ---
  
  ```{r}
  library(ggplot2)
  print("中文")
  df &lt;- data.frame(
    gp = factor(rep(letters[1:3], each = 10)),
    y = rnorm(30)
  )
  ds &lt;- plyr::ddply(df, "gp", plyr::summarise, mean = mean(y), sd = sd(y))
  
  # The summary data frame ds is used to plot larger red points on top
  # of the raw data. Note that we don't need to supply `data` or `mapping`
  # in each layer because the defaults from ggplot() are used.
  ggplot(df, aes(gp, y)) +
    geom_point() +
    geom_point(data = ds, aes(y = mean), colour = 'red', size = 3) +
    labs(x = "中文")
  ```
  </code></pre>
  
  <p>After knitting this file, it seems that the character encoding works fine for the <code>print</code> function, but the Chinese characters do not show up in graph labels, and I get errors on character conversions. I am a Mac user. 
  <a href="https://i.stack.imgur.com/TXPfC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TXPfC.png" alt="enter image description here"></a></p>