I have two datasets A and B. Both A and B have different variables but two common variable i.e. ID and Date. I want to merge the two using ID and Date. However, when i merge them using code:
C<-merge(A, B, by = "date", "ID")
The output is C dataset with 0 observations? What is going wrong here?
Update:
I used following script to merge data:
c<-merge(A, B, by = c("date", "ID"), all = TRUE).
It merges the data A and B. However, then number of observations double up. Data A has 3733 observations, Data B has 3887 observation. After merging both datasets, total number of observations for data C is 9689. It seems wrong. The total number of observation should be 3000 in number.What is wrong here?
Thanks