我正在构建一个包,但文档必须是西班牙语,包括波形符(即í,é)。
我在R文件中有这样一个简单的函数:
#' Función con acénto
#'
#' Permite instalar rápidamente de manera local un paquete previamente descargado
#' @param direccion La dirección del archivo local, poner .zip
#' @keywords FAhorroDS
#' @export
#' @encoding UTF-8
#' @author Eduardo Flores
#' @examples
#' FA_InstalarLocal("paquete_x_1.10.zip")
FA_InstalarLocal<-function(direccion)
{
install.packages(direccion, repos = NULL, type="source")
}
通过devtools::document()
构建Rd。 man生成的Rd文件似乎很好:
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/test.R
\encoding{UTF-8}
\name{FA_InstalarLocal}
\alias{FA_InstalarLocal}
\title{Función con acénto}
\usage{
FA_InstalarLocal(direccion)
}
\arguments{
\item{direccion}{La dirección del archivo local, poner .zip}
}
\description{
Permite instalar rápidamente de manera local un paquete previamente descargado
}
\examples{
FA_InstalarLocal("paquete_x_1.10.zip")
}
\author{
Eduardo Flores
}
\keyword{FAhorroDS}
但即使我在此处和DOCUMENTATION文件中指定编码,当我运行:system("R CMD Rd2pdf . --output=manual.pdf --force")
时,我收到以下错误:
Hmm ... looks like a package
Converting Rd files to LaTeX Warning: ./man/FA_InstalarLocal.Rd:6: Some input could not be re-encoded to ASCII
当我看到包时,说明没问题,但函数的标题结果为NA。
关于为什么其他一切(描述有波浪号)的任何想法都被正确编码但不标题?
> sessionInfo()
R version 3.2.4 Revised (2016-03-16 r70336)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=Spanish_Mexico.1252 LC_CTYPE=Spanish_Mexico.1252
[3] LC_MONETARY=Spanish_Mexico.1252 LC_NUMERIC=C
[5] LC_TIME=Spanish_Mexico.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] fahorro_0.1 devtools_1.10.0 magrittr_1.5 readxl_0.1.0 dplyr_0.4.3
[6] FAhorroDS_1.0.1
loaded via a namespace (and not attached):
[1] Rcpp_0.11.6 roxygen2_5.0.1 R6_2.1.2 xlsx_0.5.7 stringr_1.0.0
[6] plyr_1.8.3 tools_3.2.4 parallel_3.2.4 DBI_0.3.1 withr_1.0.0
[11] assertthat_0.1 digest_0.6.9 rJava_0.9-8 RODBC_1.3-12 xlsxjars_0.6.1
[16] memoise_1.0.0 stringi_1.0-1 SOAR_0.99-11