【问题标题】:In R, I have multiple data.frame with different length in same variable at matrix but i want to make them one data.frame [duplicate]在R中,我在矩阵的同一个变量中有多个不同长度的data.frame,但我想让它们成为一个data.frame [重复]
【发布时间】:2016-11-14 12:42:54
【问题描述】:

我应该如何将它们合并为一个?

mat<-as.matrix(x=c(df1,df2),y=c(df3,df4,df5,df6),z=c(df7,df8,df9,df10)) 

dim(mat) # 1 x 3

我想将所有 x、y 和 z 的 y

有没有技术可以做到这一点?

【问题讨论】:

标签: r dataframe merge


【解决方案1】:
df <- <- Reduce(function(x, y) merge(x, y, all=TRUE), list(df1, df2, df3, ...))

【讨论】:

    猜你喜欢
    • 2020-10-29
    • 1970-01-01
    • 1970-01-01
    • 2020-11-09
    • 1970-01-01
    • 2014-01-26
    • 1970-01-01
    • 2021-11-01
    • 1970-01-01
    相关资源
    最近更新 更多