Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 当结果=';持有';针锋相对_R_R Markdown_Knitr - Fatal编程技术网

R 当结果=';持有';针锋相对

R 当结果=';持有';针锋相对,r,r-markdown,knitr,R,R Markdown,Knitr,是否有一种方法可以在knitr中的{r results='hold'}块中分离或分割输出,而无需手动在其间插入打印('----------')命令或类似命令?我想避免这种额外的打印行,因为这会使代码更难阅读 例如,您需要经过充分的培训,才能在以下输出中看到一行的输出在何处停止,下一行的输出从何处开始: ```{r, results='hold'} summary(lm(Sepal.Length ~ Species, iris)) #print('-------------') # Not a

是否有一种方法可以在
knitr
中的
{r results='hold'}
块中分离或分割输出,而无需手动在其间插入
打印('----------')
命令或类似命令?我想避免这种额外的
打印
行,因为这会使代码更难阅读

例如,您需要经过充分的培训,才能在以下输出中看到一行的输出在何处停止,下一行的输出从何处开始:

```{r, results='hold'}
summary(lm(Sepal.Length ~ Species, iris))
#print('-------------')  # Not a solution
summary(aov(Sepal.Length ~ Species, iris))
```
输出:

Call:
lm(formula = Sepal.Length ~ Species, data = iris)

Residuals:
    Min      1Q  Median      3Q     Max 
-1.6880 -0.3285 -0.0060  0.3120  1.3120 

Coefficients:
                  Estimate Std. Error t value Pr(>|t|)    
(Intercept)         5.0060     0.0728  68.762  < 2e-16 ***
Speciesversicolor   0.9300     0.1030   9.033 8.77e-16 ***
Speciesvirginica    1.5820     0.1030  15.366  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.5148 on 147 degrees of freedom
Multiple R-squared:  0.6187,    Adjusted R-squared:  0.6135 
F-statistic: 119.3 on 2 and 147 DF,  p-value: < 2.2e-16

             Df Sum Sq Mean Sq F value Pr(>F)    
Species       2  63.21  31.606   119.3 <2e-16 ***
Residuals   147  38.96   0.265                   
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
呼叫:
lm(公式=萼片长度~种,数据=鸢尾)
残差:
最小1季度中值3季度最大值
-1.6880 -0.3285 -0.0060  0.3120  1.3120 
系数:
估计标准误差t值Pr(>t)
(截距)5.0060.0728 68.762<2e-16***
品种颜色0.9300 0.1030 9.033 8.77e-16***
弗吉尼亚种1.5820 0.1030 15.366<2e-16***
---
签名。代码:0'***'0.001'***'0.01'*'0.05'.'0.1''1
剩余标准误差:147个自由度上的0.5148
倍数R平方:0.6187,调整后的R平方:0.6135
F-统计量:在2和147 DF上为119.3,p值:<2.2e-16
Df和Sq平均Sq F值Pr(>F)

物种2 63.21 31.606 119.3是
使用两个代码块
一个选项?@TCZhang,该选项将拆分代码。我希望将代码保留在一个块中,但当代码由块中的新行生成时,在输出中进行标记。