0

我有一个这样的矩阵:

X

  [,1]   [,2]  
[1,] List,5 List,5
[2,] List,5 List,5
[3,] List,5 List,5
[4,] List,5 List,5
[5,] List,5 List,5
[6,] List,5 List,5

我如何将其转换为数据框?

当我这样做时:

head(x[1,1],2)
[[1]]

               DATE_TIME                                                     SITE RESPONSE_TIME AVAIL_PERCENT AGENT
1   2013-MAY-24 05:09 PM  Keynote Business 40 TxP - User Time (seconds)[Geo Mean]             -             - 45693
2   2013-MAY-24 05:24 PM  Keynote Business 40 TxP - User Time (seconds)[Geo Mean]             -             - 45693
3   2013-MAY-24 05:39 PM  Keynote Business 40 TxP - User Time (seconds)[Geo Mean]             -             - 45693
4   2013-MAY-24 05:54 PM  Keynote Business 40 TxP - User Time (seconds)[Geo Mean]             -             - 45693
5   2013-MAY-24 06:09 PM  Keynote Business 40 TxP - User Time (seconds)[Geo Mean]             -             - 45693
4

1 回答 1

0

首先要解决的是该列表矩阵中的位置是否具有任何意义。如果您只想将其“展平”,则可以这样做:

 # Not workig : out <- do.call( as.data.frame, c(x) )
 # Then try:

out <- do.call( rbind, as.list(x) )

如果您想要记录位置,则需要使用一种标记输出的方法,可能apply一次处理一个矩阵列或通过处理一个矩阵列。

于 2013-05-29T21:49:58.913 回答