我正在尝试使用R Sweave创建一个pdf:
\documentclass{article}
\title{Dynamic Equity vs. Bond Allocation \\ Performance Report}
\usepackage[top=0.1in, bottom=0.1in, left=1in, right=1in]{geometry}
\usepackage[labelformat=empty]{caption} % remove table 1 etc...
\begin{document}
\SweaveOpts{concordance=TRUE}
\date{\vspace{-5ex}} % remove date & suppress the space that goes with it
\maketitle
<<fooa,echo=FALSE,message=FALSE,warning=FALSE,fig.align='center',fig.width=7.5,fig.height=5.5,results="asis">>=
source("C:/Users/Top/Documents/R/Test.R")
PerformanceReport(Performance,windowRullSixMonth,windowRullOneYear)
@
\end{document}
上面的代码是从https://gist.github.com/thertrader/7038864复制的,但是adjusted
来运行我自己的功能。
但是我得到了error
:
Loading required package: stats
> grDevices::pdf.options(useDingbats = FALSE); utils::Sweave('test.Rnw', encoding='UTF-8')
Writing to file test.tex
Processing code chunks with options ...
Error in match.arg(options$results, c("verbatim", "tex", "hide")) :
'arg' should be one of "verbatim", "tex", "hide"
Calls: <Anonymous> -> SweaveParseOptions -> check -> match.arg
Error in rle(filenames) : 'x' must be an atomic vector
Calls: <Anonymous> -> SweaveParseOptions -> check -> match.arg
Execution halted
请帮助我,我真的想了解问题但找不到解决方案:/
最诚挚的问候!
答案 0 :(得分:1)
似乎你在
中使用了错误的语法..., results = "asis">>=
尝试将其更改为“tex”(假设您的代码返回有效的tex字符串)。
如果你正在使用RStudio,你可以在工具&gt;下从knitr切换到sweave。选项。