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.
我有一个data.frame df,有600多个变量。我正在编写一个函数来自动创建列,并需要对它们进行一次可视检查。
The str
function provides a good summary:
str函数提供了一个很好的总结:
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]
How can I display the full list of 602 variables?
如何显示602个变量的完整列表?
2 个解决方案
#1
49
You can use the argument list.len
:
你可以使用参数列表。len:
str(df, list.len=ncol(df))
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.
如果你想打印更多的观测结果,你可以设置参数vec。len,还有一个关于所有参数的文档。
#2
6
By using argument list.len one can choose the number of variables in the data frame to list. There are two options:
通过使用参数列表。len可以选择数据帧中的变量个数。有两个选择:
a) You choose the number of variables that you want to list;
a)您选择要列出的变量的数量;
str(df, list.len = 602) # in this case I'm listing 602 variables.
b) You choose to list the total number of variables of the data frame (as mentioned by user1981275);
b)您选择列出数据帧的变量总数(如user1981275所提到的);
str(df, list.len = ncol(df))
Check R help for more info
查看R帮助了解更多信息。
> ?str
#1
49
You can use the argument list.len
:
你可以使用参数列表。len:
str(df, list.len=ncol(df))
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.
如果你想打印更多的观测结果,你可以设置参数vec。len,还有一个关于所有参数的文档。
#2
6
By using argument list.len one can choose the number of variables in the data frame to list. There are two options:
通过使用参数列表。len可以选择数据帧中的变量个数。有两个选择:
a) You choose the number of variables that you want to list;
a)您选择要列出的变量的数量;
str(df, list.len = 602) # in this case I'm listing 602 variables.
b) You choose to list the total number of variables of the data frame (as mentioned by user1981275);
b)您选择列出数据帧的变量总数(如user1981275所提到的);
str(df, list.len = ncol(df))
Check R help for more info
查看R帮助了解更多信息。
> ?str