Import Data

Here we import data for at least 3 variables as required. We will use the same countries (Colombia, Mexico, Cuba) but expand the indicators to include male literacy and female primary school enrollment for comparison.

## # A tibble: 6 Ă— 7
##   country iso2c iso3c  year female_literacy male_literacy school_enroll_primar…¹
##   <chr>   <chr> <chr> <int>           <dbl>         <dbl>                  <dbl>
## 1 Colomb… CO    COL    1990            NA            NA                       NA
## 2 Colomb… CO    COL    1991            NA            NA                       NA
## 3 Colomb… CO    COL    1992            NA            NA                       NA
## 4 Colomb… CO    COL    1993            91.2          91.0                     NA
## 5 Colomb… CO    COL    1994            NA            NA                       NA
## 6 Colomb… CO    COL    1995            NA            NA                       NA
## # ℹ abbreviated name: ¹​school_enroll_primary_female

Transform to Long Format

The requirement is to produce a “long” version of the data. We will use pivot_longer() from the tidyverse to change our data from wide to long. The final tibble will have one row per country, per year, per indicator.

## # A tibble: 6 Ă— 4
##   country_name  Year variable                     value
##   <chr>        <int> <chr>                        <dbl>
## 1 Colombia      1993 female_literacy               91.2
## 2 Colombia      1993 male_literacy                 91.0
## 3 Colombia      1996 female_literacy               91.3
## 4 Colombia      1996 male_literacy                 91.1
## 5 Colombia      2000 school_enroll_primary_female 123. 
## 6 Colombia      2001 school_enroll_primary_female 119.

Summarize the Values

Now we calculate the mean and standard deviation for each variable, for each year, across the 3 countries. This will show us the “average” trend and the “divergence” (spread) between the countries over time.

## # A tibble: 6 Ă— 4
##    Year variable                     mean_value sd_value
##   <int> <chr>                             <dbl>    <dbl>
## 1  1990 female_literacy                    85.0       NA
## 2  1990 male_literacy                      90.3       NA
## 3  1990 school_enroll_primary_female      101.        NA
## 4  1991 school_enroll_primary_female      100.        NA
## 5  1992 school_enroll_primary_female      102.        NA
## 6  1993 female_literacy                    91.2       NA

Plot Temporal Evolution

Finally, we plot the temporal evolution of the mean and standard deviation for our variables. We use facet_wrap(~ variable) to create separate plots for each indicator, which is helpful since they have different scales.

Plot 1: Evolution of Mean Values

This plot shows the average value for each indicator across Colombia, Mexico, and Cuba from 1990 to 2020.

Plot 2: Evolution of Standard Deviation

This plot shows how different the three countries are from each other. A high value means the countries are very spread out; a low value means they are converging.

Discussion and Interpretation

The analysis of three female-focused indicators—literacy, labor force participation, and primary school enrollment—across Colombia, Mexico, and Cuba from 1990 to 2020 reveals several important patterns:

Female Literacy Rate: Literacy shows a steady upward trajectory, with mean values approaching near-universal levels by the late 2000s. The low standard deviation indicates that progress was consistent across countries, suggesting strong educational policies and sustained investment in basic education.

Female Labor Force Participation: Labor force participation demonstrates more variability than literacy. While the mean values increased gradually, the wider standard deviation bands highlight differences in how quickly each country integrated women into the workforce. This reflects structural economic differences and varying social norms around female employment.

Female Primary School Enrollment: Enrollment rates are high but fluctuate more than literacy, especially in earlier years. The variability suggests that while access to primary education expanded, retention and completion rates may have differed across countries. Over time, the narrowing of the standard deviation bands points to convergence in educational opportunities.

Overall, the combined plot illustrates a story of progress: literacy and enrollment have largely stabilized at high levels, while labor force participation continues to evolve with broader economic and social transformations. The use of mean and standard deviation provides a clear lens into both central trends and cross-country disparities, showing how educational gains have been more uniform than labor market outcomes.

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.