在R语言中,合并两个数据集可以使用merge()函数或者dplyr包中的left_join()、right_join()、inner_join()、full_join()等函数来实现。
merged_data <- merge(data1, data2, by = "key_column")
library(dplyr)
# left join
merged_data <- left_join(data1, data2, by = "key_column")
# right join
merged_data <- right_join(data1, data2, by = "key_column")
# inner join
merged_data <- inner_join(data1, data2, by = "key_column")
# full join
merged_data <- full_join(data1, data2, by = "key_column")
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读: r语言去掉空值的方法是什么