unlist and transpose

After using sapply(data, unlist), I have what I think is a matrix of vectors or maybe it's still a list. The output looks like:

 [[index1]]     
  c1  
  "value"  
  c2  
  "value"   
  c3    
  "value"  
  [[index2]]  
  c1  
  "value"  
  c2  
  "value"    
  c3  
  "value"  

My desired output is for each index to become a row in a data frame with "c1", "c2", and "c3" as columns. I already tried a simple transpose- t(). I would imagine that I could do this using reshape or plyr, but I can't figure it out.

Note: My question is very similar to Getting dataframe directly from JSON-file?, but notice that after sapply the columns contain vectors.


尝试rbind格式化您的sapply输出:

a=list(a=1:3, b=4:6)
as.data.frame(do.call(rbind, a))
链接地址: http://www.djcxy.com/p/38284.html

上一篇: 跨运行如何应用功能

下一篇: unlist和转置