檢查我的[R包Knitr,R包檢查錯誤,對象opts_chunk'未找到
> Error: could not find function "locdata"
> Execution halted
> when running code in ‘DFSurvey.Rnw’
> ...
>
> > opts_chunk$set(cache = TRUE, fig.path = "DFSurveyImages/", dev = "pdf")
>
> When sourcing ‘DFSurvey.R’:
> Error: object 'opts_chunk' not found
> Execution halted
時
藝輝謝(knitr開發商)說,這是因爲在RStudio,knitr不是我收到以下錯誤設置爲編織的方法.Rnw文件,https://groups.google.com/forum/?fromgroups#!topic/knitr/9672CBbc8CM。我已經在這兩個工具knitr設置和編譯選項,在R軟件包說明文件,我有:
VignetteBuilder: knitr
Suggests: knitr
,並在小插曲,我有:
%\VignetteEngine{knitr}
%\VignetteDepends{knitr,xtable,TSP}
當我使用編譯RStudio的PDF或使用knit(「KNITR.Rnw」),它編譯正確。當我檢查包裹時,我得到了每個小插曲的上述錯誤。我甚至把
require(knitr)
我opts_chunk $組語句之前。這沒有幫助。我也從命令行運行檢查並得到相同的錯誤。感謝您的任何幫助。
Knitr是一個有用的軟件包。我在vignettes中運行很長時間的模擬,並且緩存可以在每次不運行模擬的情況下糾正錯誤。它沒有試圖找到Sweave.sty文件的問題。
這是我sessionInfo()
> R version 3.0.0 (2013-04-03)
> Platform: x86_64-apple-darwin10.8.0 (64-bit)
>
> locale:
> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>
> attached base packages:
> [1] tcltk grid stats graphics grDevices utils datasets methods
> [9] base
>
> other attached packages:
> [1] DualFrame_0.5 xtable_1.7-1 TSP_1.0-7
> [4] maptools_0.8-23 lattice_0.20-15 foreign_0.8-53
> [7] spsurvey_2.5 sp_1.0-9 stringr_0.6.2
> [10] sqldf_0.4-6.4 RSQLite.extfuns_0.0.1 chron_2.3-43
> [13] gsubfn_0.6-5 proto_0.3-10 RSQLite_0.11.3
> [16] DBI_0.2-7 knitr_1.2 gpclib_1.5-5
>
> loaded via a namespace (and not attached):
> [1] deldir_0.0-22 digest_0.6.3 evaluate_0.4.3 formatR_0.7 MASS_7.3-26
> [6] rgeos_0.2-17 tools_3.0.0
你能提供一個複製這個問題的最小工作示例嗎? –
@TylerRinker,你爲什麼在調用opts_chunk $ set()'「)之前刪除了你的答案(」add'library('knitr')'')?看起來像一個好主意給我... –
他們說,他們使用前要求$大塊鍋。現在我會取消刪除它。 –