将Data.frames的列表重新组合成单​​个数据帧 [英] Recombining a list of Data.frames into a single data frame

查看:115
本文介绍了将Data.frames的列表重新组合成单​​个数据帧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果这个问题已经得到回答,我很抱歉。此外,这是我第一次在stackoverflow。



我有一个关于列表,数据框架和 merge()和/或<$ c $的初学者R问题c> rbind()。



我从一个面板开始看起来像这样

  COUNTRY YEAR VAR 
A 1
A 2
B 1
B 2

为了效率,我创建了一个列表,其中包含每个国家的一个数据框架,并对每个单独的 data.frame 执行各种计算。然而,我似乎不能将各个数据帧再次组合成一个大帧。



rbind() merge()我只允许更换元素。



有人可以告诉我我做错了什么,以及如何实际重组数据框?



谢谢你

解决方案

也许你想做一些像



do.call(rbind,my.df.list)


I am sorry if this question has been answered already. Also, this is my first time on stackoverflow.

I have a beginner R question concerning lists , data frames and merge() and/or rbind().

I started with a Panel that looks like this

COUNTRY YEAR VAR
A         1
A         2
B         1
B         2

For efficiency purposes, I created a list that consists of one data frame for each country and performed a variety of calculations on each individual data.frame. However, I cannot seem to combine the individual data frames into one large frame again.

rbind() and merge() both tell me that only replacement of elements is allowed.

Could someone tell me what I am doing wrong/ and how to actually recombine the data frames?

Thank you

解决方案

Maybe you want to do something like:

do.call("rbind", my.df.list)

这篇关于将Data.frames的列表重新组合成单​​个数据帧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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