> x <- data.frame(id=c("A","B","C","D","E"),height=c(155,165,175,176,180), stringsAsFactors = F);x
id height
1 A 155
2 B 165
3 C 175
4 D 176
5 E 180
> y <- data.frame(id=c("D","B","C","A","F"),weight=c(52,65,68,72,80), stringsAsFactors = F)
> y
id weight
1 D 52
2 B 65
3 C 68
4 A 72
5 F 80
我想将两个表根据id合并一起,但以x为主表,y为附表,然后合并后效果是这样子
id height weight
1 A 155 72
2 B 165 65
3 C 175 68
4 D 176 52
5 E 180 NA
请问该怎么做?谢谢~