列表输出被截断-如何在R中使用str()扩展列出的变量 [英] list output truncated - How to expand listed variables with str() in R

查看:414
本文介绍了列表输出被截断-如何在R中使用str()扩展列出的变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带600多个变量的data.frame df.我正在编写一个函数,该函数可以自动创建列,并且需要在视觉上对其进行一次检查.

I have a data.frame df with 600+ variables. I'm writing a function that automates the creation of columns and need to visually check them once.

str函数提供了一个很好的摘要:

The str function provides a good summary:

str(df)
'data.frame':   29 obs. of  602 variables:
 $ uniqueSessionsIni: POSIXct, format: "2015-01-05 15:00:00" "2015-01-05 16:00:00" "2015-01-05 17:00:00" ...
 $ uniqueSessionsEnd: POSIXct, format: "2015-01-05 15:59:00" "2015-01-05 16:59:00" "2015-01-05 17:59:00" ...
 $ m0p0             : POSIXct, format: "2015-01-05 15:00:00" "2015-01-05 15:00:00" "2015-01-05 15:00:00" ...
 $ m1p0             : POSIXct, format: "2015-01-05 15:01:00" "2015-01-05 15:01:00" "2015-01-05 15:01:00" ...
 $ m2p0             : POSIXct, format: "2015-01-05 15:02:00" "2015-01-05 15:02:00" "2015-01-05 15:02:00" ...    

然后继续...
但会截断输出,如下所示:

and it goes on...
but truncates the output, as below:

$ m33p1            : POSIXct, format: "2015-01-05 15:34:00" "2015-01-05 15:34:00" "2015-01-05 15:34:00" ...
$ m34p1            : POSIXct, format: "2015-01-05 15:35:00" "2015-01-05 15:35:00" "2015-01-05 15:35:00" ...
$ m35p1            : POSIXct, format: "2015-01-05 15:36:00" "2015-01-05 15:36:00" "2015-01-05 15:36:00" ...
$ m36p1            : POSIXct, format: "2015-01-05 15:37:00" "2015-01-05 15:37:00" "2015-01-05 15:37:00" ...
[list output truncated]

如何显示602个变量的完整列表?

How can I display the full list of 602 variables?

推荐答案

您可以使用参数list.len:

str(df, list.len=ncol(df))

如果要打印更多观察结果,可以设置参数vec.len,也可以查看?str获取所有参数的文档.

and if you want to print more observations you could set the argument vec.len, also have a look at ?str for documentation of all arguments.

这篇关于列表输出被截断-如何在R中使用str()扩展列出的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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