显示R Notebook的输出时,将完整显示文本输出。有没有办法只显示文本输出的第一部分,以获得输出内容的“要点”?
例如,下面的输出显示了一个文本块。我意识到print()
命令不知道应该显示什么。但是,在显示R笔记本时,我想避免多页长的文本输出。可以将文本输出块限制为特定大小。
答案 0 :(得分:-2)
我不确定'gist'是什么意思,因为摘要已经给出了数据框的要点......但是这里有各种命令来查看一些数据集。
> summary(mtcars[1])
mpg
Min. :10.40
1st Qu.:15.43
Median :19.20
Mean :20.09
3rd Qu.:22.80
Max. :33.90
> str(summary(mtcars))
'table' chr [1:6, 1:11] "Min. :10.40 " "1st Qu.:15.43 " ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:6] "" "" "" "" ...
..$ : chr [1:11] " mpg" " cyl" " disp" " hp" ...
> head(summary(mtcars),1)
mpg cyl disp hp
Min. :10.40 Min. :4.000 Min. : 71.1 Min. : 52.0
drat wt qsec vs
Min. :2.760 Min. :1.513 Min. :14.50 Min. :0.0000
am gear carb
Min. :0.0000 Min. :3.000 Min. :1.000
> tail(summary(mtcars),1)
mpg cyl disp hp
Max. :33.90 Max. :8.000 Max. :472.0 Max. :335.0
drat wt qsec vs
Max. :4.930 Max. :5.424 Max. :22.90 Max. :1.0000
am gear carb
Max. :1.0000 Max. :5.000 Max. :8.000
> summary(mtcars)[,1]
"Min. :10.40 " "1st Qu.:15.43 " "Median :19.20 " "Mean :20.09 "
"3rd Qu.:22.80 " "Max. :33.90 "
> summary(mtcars)[1,]
mpg cyl disp hp
"Min. :10.40 " "Min. :4.000 " "Min. : 71.1 " "Min. : 52.0 "
drat wt qsec vs
"Min. :2.760 " "Min. :1.513 " "Min. :14.50 " "Min. :0.0000 "
am gear carb
"Min. :0.0000 " "Min. :3.000 " "Min. :1.000 "