显示/打印 tibble (tbl_df) 的所有行 [英] Display / print all rows of a tibble (tbl_df)
问题描述
tibble
(以前是 tbl_df
)是由 R 中的 dplyr
数据帧操作包创建的数据帧的一个版本.它可以防止长意外调用数据框时的表输出.
tibble
(previously tbl_df
) is a version of a data frame created by the dplyr
data frame manipulation package in R. It prevents long table outputs when accidentally calling the data frame.
一旦数据框被 tibble
/tbl_df
包裹,是否有命令查看整个数据框(数据框的所有行和列))?
Once a data frame has been wrapped by tibble
/tbl_df
, is there a command to view the whole data frame though (all the rows and columns of the data frame)?
如果我使用 df[1:100,]
,我会看到所有 100 行,但如果我使用 df[1:101,]
,它只会显示前 10 行.我想轻松显示所有行以快速滚动浏览它们.
If I use df[1:100,]
, I will see all 100 rows, but if I use df[1:101,]
, it will only display the first 10 rows. I would like to easily display all the rows to quickly scroll through them.
是否有 dplyr 命令来抵消这种情况,或者有一种解开数据帧的方法?
Is there either a dplyr command to counteract this or a way to unwrap the data frame?
推荐答案
你也可以使用
print(tbl_df(df), n=40)
或在管道操作员的帮助下
or with the help of the pipe operator
df %>% tbl_df %>% print(n=40)
要打印所有行,请指定 tbl_df %>% print(n = Inf)
To print all rows specify tbl_df %>% print(n = Inf)
编辑 31.07.2021:在 >dplyr 1.0.0
edit 31.07.2021: in > dplyr 1.0.0
Warning message:
`tbl_df()` was deprecated in dplyr 1.0.0.
Please use `tibble::as_tibble()` instead.
df %>% as_tibble() %>% print(n=40)
这篇关于显示/打印 tibble (tbl_df) 的所有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!