I'm trying to create a simple regression model with a time series dataset.
The dataset includes 24 countries in the time period 2007-2020, and shows a country's Gini coefficient in the 1st sheet, and their GDP per capita in the 2nd.
I would like to find whether GDP per capita has a significant effect on the Gini coefficient, but I don't know how to start, unless the only option is to create 24 different regressions for each country.
The first step is to get the data all into one dataframe using merge()--or better, use tidyverse and get the data into one tibble using left_join().
Next, lm(Ginie ~ GDPperCapita). After that, you might think about including the country identifier as a factor in the regression in order to create dummy variables for each country.