R笔记本不评估块

时间:2017-01-10 17:24:31

标签: r rstudio rnotebook

我在Rstudio中试用了新的R笔记本电脑功能,但是没有评估。当我预览rstudio中的最小例子时(当你开始一个新文件时)窗口明确说明;

Try executing this chunk by clicking the *Run* button within the chunk or by placing your cursor inside it and pressing *Ctrl+Shift+Enter*.

然而,没有"运行"预览中的按钮和代码不评估。这就是我基本上得到的(即使我将eval = TRUE放在块选项中)。

enter image description here

我已经全身心投入但我仍然无法得到大量的评价。使用普通的rmarkdown文档时,它会毫无问题地进行评估。我是否必须放置特定的htmlwidget或其他内容?

以下是我的规格:

R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] tse.sql_0.1.0   memisc_0.99.7-1 MASS_7.3-45     lattice_0.20-34 foreign_0.8-67  magrittr_1.5    ggplot2_2.2.0  
 [8] inegiR_1.2.0    dplyr_0.5.0     tse.utils_0.1.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.7      knitr_1.14       munsell_0.4.3    colorspace_1.2-7 R6_2.2.0         stringr_1.1.0    plyr_1.8.4      
 [8] tools_3.3.2      grid_3.3.2       gtable_0.2.0     DBI_0.5-1        htmltools_0.3.5  lazyeval_0.2.0   yaml_2.1.13     
[15] assertthat_0.1   digest_0.6.10    tibble_1.2       formatR_1.4      base64enc_0.1-3  evaluate_0.10    rmarkdown_1.1   
[22] stringi_1.1.2    scales_0.4.1     XML_3.98-1.4     jsonlite_1.1     zoo_1.7-13    

使用Rstudio 1.0.44和这些选项:

enter image description here

enter image description here

2 个答案:

答案 0 :(得分:1)

作为一个功能(或错误),当您单击“预览”时,笔记本中的块不会运行,而是在您评估每个块时(在编写Notebook本身的过程中)。 Notebook and Output before code is run

如果您在发布前运行笔记本中的所有代码,使用源窗格右上角的“运行”按钮,RStudio可以找到您要嵌入的对象。

Notebook and Output after code is run

或者,您可以单击Notebook中每个代码块右上角的绿色播放(右箭头)来运行每个代码块。

答案 1 :(得分:0)

使用CTRL + SHIFT + Enter运行代码块。如果现在预览R Notebook,则代码输出将可用。 代码必须在编辑器中执行,然后才能反映在预览中。

相关问题