Found this issue while working on a hobby project of mine. Stack Overflow survey converts salaries reported in other currencies to USD.
The survey from 2020 uses exchange rates from 2020-02-19: https://insights.stackoverflow.com/survey/2020
We converted salaries from user currencies to USD using the exchange rate on 2020-02-19, and also converted to annual salaries assuming 12 working months and 50 working weeks.
The survey from 2021 is supposed to use exchange rates from 2021-06-16: https://insights.stackoverflow.com/survey/2021
We converted salaries from user currencies to USD using the exchange rate on 2021-06-16, and also converted to annual salaries assuming 12 working months and 50 working weeks.
USD to EUR conversion rate on 2020-02-19 was 0.9251 (https://www.exchange-rates.org/exchange-rate-history/usd-eur-2020-02-19).
USD to EUR conversion rate on 2021-06-16 was 0.8337 (https://www.exchange-rates.org/exchange-rate-history/usd-eur-2021-06-16).
However, when inspecting full datasets, the exchange rate from 2020 is used in both years. See the following R code for details.
library(tidyverse)
library(janitor)
# download files ----------------------------------------------------------
download.file("http://info.stackoverflowsolutions.com/rs/719-EMH-566/images/stack-overflow-developer-survey-2020.zip",
'stack-overflow-developer-survey-2020.zip')
download.file("http://info.stackoverflowsolutions.com/rs/719-EMH-566/images/stack-overflow-developer-survey-2021.zip",
'stack-overflow-developer-survey-2021.zip')
# import ----------------------------------------------------------------
data_2020 <-
unz('stack-overflow-developer-survey-2020.zip', 'survey_results_public.csv') |>
read_csv() |>
clean_names()
data_2021 <-
unz('stack-overflow-developer-survey-2021.zip', 'survey_results_public.csv') |>
read_csv() |>
clean_names()
# check exchange rates for yearly frequencies ----------------------------
old <- options(pillar.sigfig = 10)
data_2020 |>
filter(currency_desc == 'European Euro') |>
select(comp_total, comp_freq, converted_comp) |>
filter(!is.na(comp_total)) |>
filter(comp_freq == 'Yearly') |>
mutate(exchange_rate = round(comp_total / converted_comp, 4)) |>
count(exchange_rate, sort = TRUE)
# Result:
# 0.9251
data_2021 |>
filter(currency == 'EUR European Euro') |>
select(comp_total, comp_freq, converted_comp_yearly) |>
filter(!is.na(comp_total)) |>
filter(comp_freq == 'Yearly') |>
mutate(exchange_rate = round(comp_total / converted_comp_yearly, 4)) |>
count(exchange_rate, sort = TRUE)
# Result:
# 0.9251
# check exchange rates for monthly frequencies ----------------------------
data_2020 |>
filter(currency_desc == 'European Euro') |>
select(comp_total, comp_freq, converted_comp) |>
filter(!is.na(comp_total)) |>
filter(comp_freq == 'Monthly') |>
mutate(exchange_rate = round(comp_total * 12 / converted_comp, 3)) |>
count(exchange_rate, sort = TRUE)
# Result:
# 0.925
data_2021 |>
filter(currency == 'EUR European Euro') |>
select(comp_total, comp_freq, converted_comp_yearly) |>
filter(!is.na(comp_total)) |>
filter(comp_freq == 'Monthly') |>
mutate(exchange_rate = round(comp_total * 12 / converted_comp_yearly, 3)) |>
count(exchange_rate, sort = TRUE)
# Result:
# 0.925