我对R,RStudio,LaTeX,knitr甚至stackoverflow都是新手。我想通过LaTeX在RStudio中生成一个pdf文件。
我已经编写了以下脚本,该脚本工作正常:
\documentclass{article}
\begin{document}
<<setup, echo=FALSE, warning=FALSE>>=
library("xtable")
source("D:\\Programming\\Testing\\2017-03-13\\UniDF.R")
@
<<xtable, results = "asis", echo=FALSE>>=
print(xtable(uni_kassel), type = "latex")
@
<<barplot, echo=FALSE, results='hide'>>=
#Loop through rows in df
for (i in seq(from = 1, to = nrow(uni_kassel), by = 1))
{
#Create subset from df
data <- matrix(c(subset(uni_kassel$Studenten,
fb == uni_kassel$Fachbereich[i]),
subset(uni_kassel$Absolventen,
fb == uni_kassel$Fachbereich[i])))
#Create first barplot
print(source("D:\\Programming\\Testing\\2017-03-08\\SimpleBarChart.R"))
}
@
\end{document}
我真的很感激你的帮助。