我有两张类似的表记录了有人花了3个多月的时间。 从4-6个月开始,新增了一个变量。
df1 = data.frame(Month=c(1,2,3),Rent=c(132,123,234),Food=c(34,13,45))
df2 = data.frame(Month=c(4,5,6),Rent=c(111,212,231),Food=c(33,11,41),Fun=c(4,6,5))
> df1
Month Rent Food
1 1 132 34
2 2 123 13
3 3 234 45
> df2
Month Rent Food Fun
1 4 111 33 4
2 5 212 11 6
3 6 231 41 5
如何将两个表组合/合并为:
Month Rent Food Fun
1 1 132 34 NA
2 2 123 13 NA
3 3 234 45 NA
4 4 111 33 4
5 5 212 11 6
6 6 231 41 5
答案 0 :(得分:2)
您可以在[INFO] 2016-05-18T01:30:47.900Z 241f0cfc-1c98-12e6-b9a7-cf406f32a0dc Response: {u'AcceptRanges': 'bytes', u'ContentType': 'binary/octet-stream', 'ResponseMetadata': {'HTTPStatusCode': 200, 'HostId': 'K8JMVbEt5xA+qXuXOedb1y5nxuv6scMXnNH/rHVtxcg=', 'RequestId': 'D05BE92E55E0'}, u'LastModified': datetime.datetime(2016, 5, 17, 22, 54, 37, tzinfo=tzutc()), u'ContentLength': 94320, u'ETag': '"0e4d457d912bce9ff81952"', u'Metadata': {'author': 'Satyajit Ray', 'description':'He was an Indian filmmaker, widely regarded as one of the greatest filmmakers of the 20th century.'}}
Author : Satyajit Ray
Description : He was an Indian filmmaker, widely regarded as one of the greatest filmmakers of the 20th century.
包中使用join family函数执行此类任务,如下所示:
dplyr