将列表转换为数据框 - Convert a list to a data frame

问题:

I have a nested list of data.我有一个嵌套的数据列表。 Its length is 132 and each item is a list of length 20. Is there a quick way to convert this structure into a data frame that has 132 rows and 20 columns of data?它的长度是 132,每一项都是一个长度为 20 的列表。有没有一种快速的方法可以把这个结构转换成一个有 132 行和 20 列数据的数据框?

Here is some sample data to work with:以下是一些可以使用的示例数据:

l <- replicate(
  132,
  as.list(sample(letters, 20)),
  simplify = FALSE
)

解决方案:

参考一: https://en.stackoom.com/question/Hjh1
参考二: https://stackoom.com/question/Hjh1
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章