[英]How to print RMarkdown chunk code output in Console?
As I test my R code in a chunk in R Markdown, I want all my print
outputs to be shown in separate console window (not only below the code chunk, which is way down below, because my chunk is long – so I can't easily view it) As I test my R code in a chunk in R Markdown, I want all my
print
outputs to be shown in separate console window (not only below the code chunk, which is way down below, because my chunk is long – so I can' t 轻松查看)
I noted that in code below我注意到在下面的代码中
---
title: "How to print rmarkdown code chunk output in Console?"
output: html_document
---
```{r}
names(mtcars)
print(mtcars)
the print output of the first line is actually displayed both in Editor window below the chunk and in Console (see below)– that's great.第一行的打印 output 实际上显示在块下方的编辑器 window 和控制台中(见下文) - 这很棒。
However the print output of the second line (as of any list) is not shown in Console – and that's very inconvenient.然而,第二行的打印 output (与任何列表一样)未显示在控制台中 - 这非常不方便。
> names(mtcars)
[1] "mpg" "cyl" "disp" "hp" "drat" "wt" "qsec" "vs" "am" "gear"
[11] "carb"
> print(mtcars)
Is there a trick to address this inconvenience?有什么技巧可以解决这种不便吗?
Go to Tools > Global Options > R Markdown, and untick "Show output inline for all R Markdown documents". Go to Tools > Global Options > R Markdown, and untick "Show output inline for all R Markdown documents".
> names(mtcars)
[1] "mpg" "cyl" "disp" "hp" "drat" "wt" "qsec" "vs" "am" "gear" "carb"
> print(head(mtcars))
mpg cyl disp hp drat wt qsec vs am gear carb
Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4
Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4
Datsun 710 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1
Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1
Hornet Sportabout 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2
Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.