2015-09-15 57 views
1

我是R新手,一直試圖在R markdown中編寫我的項目報告。但是我面臨的問題。我嘗試了實現堆棧溢出以及其他網站上的解決方案,但是我一直未能取得進展。從TeX源代碼生成PDF錯誤錯誤:由於錯誤43導致pandoc文檔轉換失敗執行被終止

詳情:

[R版本3.2.1(2015年6月18日) - 「世界著名的宇航員」

RStudio版本0.99.441 - ©2009-2015

的Mac OS X約塞米蒂版本10.10.5

安裝pandoc 1.15.0.6 https://github.com/jgm/pandoc/releases/tag/1.15.0.6

從0123的MacTEX都-2015配

MacTEX都-20150613

在使用XeLaTex我有使用knitr,LaTeX的排版編織RNW文件全局選項轉換成PDF,編譯後已取消清潔輔助輸出。

我得到以下錯誤:

輸出文件:07.Random_Forest.knit.md

在/ usr/local/bin目錄/ pandoc 07.Random_Forest.utf8.md --to乳膠--from markdown + autolink_bare_uris + ascii_identifiers + tex_math_single_backslash-implicit_figures --output 07.Random_Forest.pdf --template /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rmarkdown/rmd/latex/default-1.14.tex - 高亮風格的探戈--latex-engine/Library/TeX/texbin/pdflatex !未定義的控制順序。 l.921 {\定心\ includegraphics

pandoc:從源的TeX 錯誤錯誤產生PDF:pandoc文檔轉換失敗,錯誤43 執行暫停的我的 - [R減價代碼

部分附以供參考:

--- 
title: "Decision Trees and Random Forest" 

paper: a4paper 
fontsize: 12pt 
geometry: 
    - tmargin=2cm 
    - bmargin=2cm 
    - lmargin=3cm 
    - rmargin=3cm 
documentclass: report 
classoption: twoside, bindingoffset=1cm 
linkcolor: blue 

author: "Chaitanya Jagtap" 
date: "15 September 2015" 
output: pdf_document 


--- 

opts_chunk$set(echo=FALSE, warning=FALSE, message=FALSE, error=FALSE, collapse=TRUE,  tidy=TRUE, highlight=TRUE, comment='') 

opts_knit$set(progress=TRUE, verbose=TRUE) 




```{r include=TRUE} 

library(extrafont) 
loadfonts() 

library(SDMTools) 
library(caTools) 
library(randomForest) 
library(rpart) 
library(rattle) 
library(rpart.plot) 
library(RColorBrewer) 
library(partykit) 

library(rmarkdown) 
library(geometry) 
library(knitr) 
library(highr) 
library(xtable) 


set.seed(211) 

fonttable() 

options(digits=4) 
par(cex=0.9,cex.axis=1,cex.lab=1,cex.main=1.2,cex.sub=1, 
    font=1,font.axis=1,font.lab=2,font.main=2,font.sub=1, 
    pin=c(4,3), mai=c(1, 1, 1, .2), oma=c(0.2,0.2,2,0.2), mgp = c(3, 1, 0),   adj=0.5, 
    las=0, xaxs="i", yaxs="i", 
    col.lab = "firebrick4", col.main="deepskyblue4", col.sub="royalblue",  lab=c(10,10,7), 
    lwd=2,family="Times New Roman", ps=12) 


setwd("/Users/Urmila/Desktop/Chaitanya/Study/001_Great  Lakes/001_Capstone/002_Give_me_some_credit/") 

load("capstone_df_train.RData") 
load("capstone_df_test.RData") 

xyvar <- c("GB", "Age_woe", "num_30_59_dpd_woe", "num_60_89_dpd_woe",  "num_90_dpd_woe", 
      "num_open_trades_woe", "num_RE_trades_woe", "Rev_Util_unsec_woe",  "Debt_Ratio_woe", 
      "MI_num_depend_woe") 

xvar <- c("Age_woe", "num_30_59_dpd_woe", "num_60_89_dpd_woe", "num_90_dpd_woe", 
      "num_open_trades_woe", "num_RE_trades_woe", "Rev_Util_unsec_woe",  "Debt_Ratio_woe", 
      "MI_num_depend_woe") 

capstone_df_train_xyvar <- capstone_df_train[xyvar] 
capstone_df_test_xyvar <- capstone_df_test[xyvar] 


weight <- ifelse(capstone_df_train_xyvar$GB == 0,1,12) 

dtree_train <- rpart(GB ~ ., data=capstone_df_train_xyvar, 
        method="class", parms=list(split="information"), 
        minsplit = 1000, minbucket = 500, cp=-1, 
        weights = weight) 
``` 

```{r include = TRUE} 

dtree_train$cptable 

``` 



```{r include=TRUE, fig.align='center', fig.cap="Plot of cross-validated error  against complexity parameter cp"} 

plotcp(dtree_train, minline = TRUE, lty=2, col = "firebrick", upper = "size") 
mtext("Plot of cross-validated error against complexity parameter cp",   side=3,  cex=1.1, 
line=0.6, col = "dodgerblue4", outer=TRUE) 
box("plot", col="blue", lty = "solid") 
box("figure", col="forestgreen", lty = "solid") 

``` 

謝謝你的時間和幫助。

切塔尼亞

+1

檢查這個http://stackoverflow.com/questions/26974670/error-pandoc-document-conversion-failed-with-error-43-windows-7-r-studio – PereG

回答

1

Pandoc不知道你的輸出包含圖形,因爲你使用了大塊選項fig.align = 'center'。您可以將graphics: yes添加到您的R Markdown文檔的YAML元數據中。

+0

謝謝Yihui,我能夠得到現在輸出pdf。 –

相關問題