'Bind spatial data frames
I have a long panel dataset (Data_Base) with the name of the 32 states in Mexico through 28 years in time (928 obs). I have in another .rds file the spatial data for these 32 states (mex.sf), in total of 32 obs. I want to bind the dataset with the spatial data. Of course the spatial data from the file mex.sf should be repeated 28 times per state due the difference in longitude of observations. I try with the following command specifying the condition to merge per name of state:
example <- merge(Data_Base, mex.sf, by=intersect(Data_Base$State,mex.sf$NAME_1))
Nevetheless I ended up with the following error message:
Error in fix.by(by.x, x) : 'by' must specify uniquely valid columns
Bellow an example of how the data looks like
Does anyone knows why cannot bind them?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


