I have two data frames in R as below...I need to add new column(count_orders) in df1 which contains count of orders in df2 (or count of buyer in df2). Please help.
> df1
buyer city
1 A xx
2 B yy
3 C zz
> df2
order buyer item
1 1 A 1
2 2 A 2
3 3 B 1
4 4 A 2
5 5 B 1
6 6 C 3
7 7 C 4
Expected output:
> df1
buyer city count_orders
1 A xx 3
2 B yy 2
3 C zz 2