R包dplyr中的head()函数 [英] head() function in R package dplyr

查看:99
本文介绍了R包dplyr中的head()函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个小问题,但是在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 :

" glimpse()可以查看tbl中的所有列,在单个行中显示尽可能多的每个变量数据."

"glimpse() makes it possible to see all the columns in a tbl, displaying as much data for each variable as can be fit on a single line."

这篇关于R包dplyr中的head()函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆