-2
兩個數據幀如何快速合併? dataframes合併兩個數據幀的列
df1<-data.frame(a=(1:5),b=(1:5))
df2<-data.frame(c=(1:5),d=(1:5))
預期輸出:
output<-data.frame(a=(1:5),b=(1:5),c=(1:5),d=(1:5))
兩個數據幀如何快速合併? dataframes合併兩個數據幀的列
df1<-data.frame(a=(1:5),b=(1:5))
df2<-data.frame(c=(1:5),d=(1:5))
預期輸出:
output<-data.frame(a=(1:5),b=(1:5),c=(1:5),d=(1:5))
您可以通過使用`cbind使用其它功能像
cbind.data.frame(df1,df2)
a b c d
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
5 5 5 5 5
或
cbind2(df1,df2)
a b c d
1 1 1 1 1
2 2 2 2 2
3 3 3 3 3
4 4 4 4 4
5 5 5 5 5
這些不是「*其他功能*」。 'cbind.data.frame'是一個'data.frame' *方法*,它在'data.frame'輸入時被'cbind'自動調用。如果滿足某些條件,'cbind2'也被'cbind'調用。這個答案比有用的IMO更令人困惑。 OP只需要讀取'?cbind' –
試試這個()' – mtoto