Merging mutiple datasets with no common variable


I am currently working with five datasets in r studio.

1)The GSDB dataset
2)The VDEM dataset
3)World Bank GDP Dataset
4)World Bank military spending/GDP Dataset
5)Uppsala armed conflict dataset

I have been trying to merge these datasets for a while now. I have already subsetted the specific variables I need, but I now find it difficult to clean and merge them. I cannot merge them just by country because I need two country columns from the GSDB dataset (sanctioned_state & sanctioning_state), and I cannot merge them by year because the two World Bank dataset have a variable for each year (so year_1960, year_1961 etc.), while the other one have one observable year column.

Can someone in this community maybe help me break this one? Thank you so much!

Look at pivot_longer() to get the world bank data into columns.

Hi there!

Thank you for your help! If I try to do this, this error occurs


Make one of the two year variables match the other

Do you mean by title or data? :slight_smile:

See the first error in the screen shot. The two variables have different types. Make the the same, using either as.character () or as.numeric()

you very much! I get this:

Just use

your_data_frame$your_numeric_var <- as.character(your_data_frame$your_numeric_var)

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.