问题描述
这是一个小问题,但是在R中,当您键入 head(data.frame)
时,会从显示的所有列中获得前几条记录.在 dplyr
包中,head函数已更改为仅显示可以容纳在控制台窗口中的列.这通常很不错,但是我经常想查看所有列的前几条记录.有没有一种方法可以告诉head(在 dplyr
中)显示所有列,而无需将 tbl.df
/ data.frame
转换为 data.frame
(相对于 str()
,我更喜欢 head
).
This is a minor issue but in R when you type head(data.frame)
you get the first few records from all the columns displayed. In the dplyr
package the head function has been altered to only show the columns that can fit in your console window. This is often nice, but often I want to see the first few records for all the columns. Is there a way to tell head (in dplyr
) to show all columns without converting the tbl.df
/data.frame
to a data.frame
(and I prefer head
to str()
).
谢谢!
ZR
推荐答案
您现在可以在dplyr 0.2中使用 glimpse()
动词:
you can now use the glimpse()
verb in dplyr 0.2 :
来自 https://github.com/hadley/dplyr/releases :
这篇关于R包dplyr中的head()函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!