I have two csv data X and Y
X - Is a Master Data with columns (id, name, dept)
Y- Kind of reference Data with columns (dept, fees)
X.csv
id name dept
1 a IT
2 b CS
3 ab Mech
4 bc IT
5 af Mech
6 Hg CS
Y.csv
dept fees
IT 1111
CS 20
Mech 100
I want output like below - In both the CSV 'dept' column is common with help of that, we have to combine this two data set and create single data set with these columns (id, name, dept, fees)
XY.csv
id name dept fees
1 a IT 1111
2 b CS 20
3 ab Mech 100
4 bc IT 1111
5 af Mech 100
6 Hg CS 20
I tried below code, but ended up in error- I dont know how to solve this.
> m=merge(X,Y,by="c")
Error in fix.by(by.x, x) : 'by' must specify a uniquely valid column