I am trying to merge different data frames with one another (I am very much a beginner).
In some of them, variables are are stored as follows: different variables are stored in different columns
Country Year GDP Life Expectancy France 2014 987 67.6 France 2015 1002 67.7
Whilst in some others, variables are stored with one column for all variable names, and the corresponding value is stored in another column:
Country Year Variable Name Value France 2014 Public Health Expenditure 28 France 2014 Percentage of Smokers 24 France 2015 Public Health Expenditure 27 France 2015 Percentage of Smokers 24
I would like to group them in a single table to perform a regression.
Ideally, I think my table would look like this:
Country Year GDP LifeExp HealthSpendings % of Smokers France 2014 987 67.6 28 24 France 2015 1002 67.7 27 24
I am not a native English speaker (and very far from being proficient in the R language too !), so even just helping me to reformulate my question could help me find the resources I need online Many thanks for your help !