Rstudio 在 Rmd 块中的控制台中运行 [英] Rstudio running in console in Rmd chunk

查看:45
本文介绍了Rstudio 在 Rmd 块中的控制台中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我没记错的话,我最近从 0.99.902 更新到 Rstudio 版本 1.0.136.曾经工作但不再工作的一件事是在控制台的块中运行部分代码,并在 Rstudio 环境的绘图部分获取输出(绘图).

I recently updated to Rstudio version 1.0.136 coming from 0.99.902 if I'm not mistaken. One of the things that used to work and doesn't anymore is to run parts of the code in the chunk in the console and get the output (plot) in the plot section of the Rstudio environment.

这是我在 .Rmd 文件中使用的代码:

Here is the code I'm using, inside of a .Rmd file:

```{r, echo=FALSE, message=FALSE, warning=FALSE, results='hide', message=FALSE}
attach(mtcars)
plot(wt, mpg) 
```

我所做的是选择块内的两行,然后按 Ctrl+Enter,该命令在控制台中运行所选行.以前这会输出一个图到图"选项卡,我可以从中导出所需的大小等.

What I do is select the two lines inside the chunk, and press Ctrl+Enter, the command to run the selected lines in the console. Previously this outputted a plot to the 'Plots' tab, from which I can export it with the desired size etc.

但是在新版本中,当使用 Ctrl+Enter 时,情节不再显示在此处,只需将代码复制/粘贴到控制台中仍然明显有效.发生了哪些变化?如何在不切换回 Rstudio 之前版本的情况下使其恢复工作?

However with the new version the plot does not show up here anymore when using Ctrl+Enter, just copy/pasting the code into the console still works obviously. What changed and how can I get it back to work without switching back to the previous version of Rstudio?

推荐答案

您需要在设置按钮(灰色链轮)下检查 Chunk output in console.

You need to check Chunk output in console under the settings button (grey sprocket).

这篇关于Rstudio 在 Rmd 块中的控制台中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆