繁体   English   中英

带R包Repmis的重音字母

[英]Accented letters with R package Repmis

我正在使用repmis处理报告中的引用,但是当引用包含带重音符号的字符时,它不会编译-在这种情况下,引用nlme软件包。

有解决办法吗?

我尝试将options(encoding = "UTF-8")到我的.RProfile,但这无济于事。 我的解决方法是将引用复制到另一个围兜文件中,并使用Window字符图中的符号。 尽管这可行,但这不是我正在寻找的解决方案。

谢谢。

错误信息:

pandoc-citeproc:无法解码字节'\\ xe9':Data.Text.Internal.Encoding.decodeUtf8:无效的UTF-8流运行过滤器pandoc-citeproc时出错:过滤器返回了错误状态1错误:pandoc文档转换失败,错误83执行中止

示例.Rmd:

---
title: "Untitled"
author: "Paul Stevenson"
date: "21 January 2019"
output: html_document
bibliography:
  - packages.bib
---

```{r}
library(repmis)
LoadandCite(pkgs = c("nlme"),
            file = "packages.bib")

```

Reference [@R-nlme]

围兜条目:

@Manual{R-nlme,
  title = {nlme: Linear and Nonlinear Mixed Effects Models},
  author = {José Pinheiro and Douglas Bates and {R-core}},
  year = {2018},
  note = {R package version 3.1-137},
  url = {https://CRAN.R-project.org/package=nlme},
}

sessionInfo():

R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_Australia.1252  LC_CTYPE=English_Australia.1252   
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C                      
[5] LC_TIME=English_Australia.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_3.5.2  htmltools_0.3.6 tools_3.5.2     yaml_2.2.0     
 [5] Rcpp_1.0.0      rmarkdown_1.11  knitr_1.21      xfun_0.4       
 [9] digest_0.6.18   evaluate_0.12  

通过打开.bib并使用write.table(fileEncoding = "UTF-8")保存,找到了更流畅的解决方案。 请参阅下面的recoder功能:

---
title: "Untitled"
author: "Paul Stevenson"
date: "21 January 2019"
output: html_document
bibliography:
  - packages.bib
---

```{r}
recoder <- function(x) {
  dat <- read.delim(file = x, header = F, stringsAsFactors = F, quote = "")
  write.table(dat, file = x, row.names = F, quote = F, col.names = F, fileEncoding = "UTF-8")
}

library(repmis)
library(nlme)
LoadandCite(pkgs = c("nlme", "biometrics"), file = "packages.bib")
recoder("packages.bib")

```

Reference [@R-nlme]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM