可以将类似数据帧的列表组合到单个数据帧中吗? [英] Can I combine a list of similar dataframes into a single dataframe?
本文介绍了可以将类似数据帧的列表组合到单个数据帧中吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个数据框:
foo <- list(df1 = data.frame(x=c('a', 'b', 'c'),y = c(1,2,3)),
df2 = data.frame(x=c('d', 'e', 'f'),y = c(4,5,6)))
我可以将其转换为单个数据框的形式:
Can I convert it to a single dataframe of the form:
data.frame(x = c('a', 'b', 'c', 'd', 'e', 'f'), y= c(1,2,3,4,5,6))
?
推荐答案
do.call(rbind,foo)
应该做的伎俩。
这篇关于可以将类似数据帧的列表组合到单个数据帧中吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文