sampling
This commit is contained in:
parent
700992fbe5
commit
9ca2f78396
5 changed files with 581 additions and 3 deletions
BIN
data/processed/m_sample.rds
Normal file
BIN
data/processed/m_sample.rds
Normal file
Binary file not shown.
255
data/processed/sampling_audit.csv
Normal file
255
data/processed/sampling_audit.csv
Normal file
|
|
@ -0,0 +1,255 @@
|
||||||
|
variable,action,fill_type,n_na_2022,pct_na_2022,n_na_final,first_year,last_year,source_year,years_from_2022,note
|
||||||
|
entitled_to_vote_by_education_level_european_parliament_election_primary_and_lower_secondary,backfill_census,census_closest,290,1,0,2019,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
entitled_to_vote_by_education_level_european_parliament_election_upper_secondary,backfill_census,census_closest,290,1,0,2019,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
entitled_to_vote_by_education_level_european_parliament_election_post_secondary,backfill_census,census_closest,290,1,0,2019,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
entitled_to_vote_by_education_level_european_parliament_election_all_education_levels,backfill_census,census_closest,290,1,0,2019,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
voting_rates_by_education_level_european_parliament_election_primary_and_lower_secondary,backfill_census,census_closest,290,1,0,2019,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
voting_rates_by_education_level_european_parliament_election_upper_secondary,backfill_census,census_closest,290,1,0,2019,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
voting_rates_by_education_level_european_parliament_election_post_secondary,backfill_census,census_closest,290,1,0,2019,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
voting_rates_by_education_level_european_parliament_election_all_education_levels,backfill_census,census_closest,290,1,0,2019,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
votes_by_party_european_parliament_election_the_moderate_party,backfill_census,census_closest,290,1,0,1995,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
votes_by_party_european_parliament_election_the_centre_party,backfill_census,census_closest,290,1,0,1995,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
votes_by_party_european_parliament_election_the_liberal_party,backfill_census,census_closest,290,1,0,1995,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
votes_by_party_european_parliament_election_the_christian_democratic_party,backfill_census,census_closest,290,1,0,1995,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
votes_by_party_european_parliament_election_the_green_party,backfill_census,census_closest,290,1,0,1995,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
votes_by_party_european_parliament_election_the_social_democratic_party,backfill_census,census_closest,290,1,0,1995,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
votes_by_party_european_parliament_election_the_left_party,backfill_census,census_closest,290,1,0,1995,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
votes_by_party_european_parliament_election_the_pirate_party,backfill_census,census_closest,290,1,0,2009,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
votes_by_party_european_parliament_election_feminist_initiative,backfill_census,census_closest,290,1,0,2014,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
votes_by_party_european_parliament_election_the_sweden_democrats,backfill_census,census_closest,290,1,0,2014,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
votes_by_party_european_parliament_election_other_parties,backfill_census,census_closest,290,1,0,1995,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
votes_by_party_european_parliament_election_invalid_ballot_papers,backfill_census,census_closest,290,1,0,1995,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
votes_by_party_european_parliament_election_non_voters,backfill_census,census_closest,290,1,0,1995,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
share_of_vote_between_parties_european_parliament_election_the_moderate_party,backfill_census,census_closest,290,1,0,1995,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
share_of_vote_between_parties_european_parliament_election_the_centre_party,backfill_census,census_closest,290,1,0,1995,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
share_of_vote_between_parties_european_parliament_election_the_liberal_party,backfill_census,census_closest,290,1,0,1995,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
share_of_vote_between_parties_european_parliament_election_the_christian_democratic_party,backfill_census,census_closest,290,1,0,1995,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
share_of_vote_between_parties_european_parliament_election_the_green_party,backfill_census,census_closest,290,1,0,1995,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
share_of_vote_between_parties_european_parliament_election_the_social_democratic_party,backfill_census,census_closest,290,1,0,1995,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
share_of_vote_between_parties_european_parliament_election_the_left_party,backfill_census,census_closest,290,1,0,1995,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
share_of_vote_between_parties_european_parliament_election_the_pirate_party,backfill_census,census_closest,290,1,0,2009,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
share_of_vote_between_parties_european_parliament_election_feminist_initiative,backfill_census,census_closest,290,1,0,2014,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
share_of_vote_between_parties_european_parliament_election_the_sweden_democrats,backfill_census,census_closest,290,1,0,2014,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
share_of_vote_between_parties_european_parliament_election_other_parties,backfill_census,census_closest,290,1,0,1995,2024,2024,2,Periodic variable — no data in 2022; backfilled from 2024 (2 years from anchor)
|
||||||
|
type_of_land_arable_land_ha,backfill_disc,discontinued_last,290,1,5,1981,1999,1999,23,"Series discontinued; backfilled from most recent available year (1999, 23 years from anchor)"
|
||||||
|
type_of_land_permanent_grassland_ha,backfill_disc,discontinued_last,290,1,6,1981,1999,1999,23,"Series discontinued; backfilled from most recent available year (1999, 23 years from anchor)"
|
||||||
|
type_of_land_forest_land_ha,backfill_disc,discontinued_last,290,1,8,1981,1999,1999,23,"Series discontinued; backfilled from most recent available year (1999, 23 years from anchor)"
|
||||||
|
type_of_land_other_land_ha,backfill_disc,discontinued_last,290,1,7,1981,1999,1999,23,"Series discontinued; backfilled from most recent available year (1999, 23 years from anchor)"
|
||||||
|
type_of_land_total_ha,backfill_disc,discontinued_last,290,1,5,1981,1999,1999,23,"Series discontinued; backfilled from most recent available year (1999, 23 years from anchor)"
|
||||||
|
livestock_horses,backfill_disc,discontinued_last,290,1,6,1981,2003,2003,19,"Series discontinued; backfilled from most recent available year (2003, 19 years from anchor)"
|
||||||
|
wealth_tax,backfill_disc,discontinued_last,290,1,0,2000,2006,2006,16,"Series discontinued; backfilled from most recent available year (2006, 16 years from anchor)"
|
||||||
|
property_tax,backfill_disc,discontinued_last,290,1,0,2000,2007,2007,15,"Series discontinued; backfilled from most recent available year (2007, 15 years from anchor)"
|
||||||
|
agricultural_enterprises_5_ha,backfill_disc,discontinued_last,290,1,6,1981,2007,2007,15,"Series discontinued; backfilled from most recent available year (2007, 15 years from anchor)"
|
||||||
|
agricultural_enterprises_5_20_ha,backfill_disc,discontinued_last,290,1,5,1981,2007,2007,15,"Series discontinued; backfilled from most recent available year (2007, 15 years from anchor)"
|
||||||
|
agricultural_enterprises_20_100_ha,backfill_disc,discontinued_last,290,1,5,1981,2007,2007,15,"Series discontinued; backfilled from most recent available year (2007, 15 years from anchor)"
|
||||||
|
agricultural_enterprises_100_ha,backfill_disc,discontinued_last,290,1,26,1981,2007,2007,15,"Series discontinued; backfilled from most recent available year (2007, 15 years from anchor)"
|
||||||
|
agricultural_enterprises_total,backfill_disc,discontinued_last,290,1,3,1981,2007,2007,15,"Series discontinued; backfilled from most recent available year (2007, 15 years from anchor)"
|
||||||
|
livestock_cattle,backfill_disc,discontinued_last,290,1,5,1981,2007,2007,15,"Series discontinued; backfilled from most recent available year (2007, 15 years from anchor)"
|
||||||
|
livestock_sheep,backfill_disc,discontinued_last,290,1,6,1981,2007,2007,15,"Series discontinued; backfilled from most recent available year (2007, 15 years from anchor)"
|
||||||
|
livestock_pigs,backfill_disc,discontinued_last,290,1,9,1981,2007,2007,15,"Series discontinued; backfilled from most recent available year (2007, 15 years from anchor)"
|
||||||
|
livestock_poultry,backfill_disc,discontinued_last,290,1,6,1981,2007,2007,15,"Series discontinued; backfilled from most recent available year (2007, 15 years from anchor)"
|
||||||
|
livestock_total,backfill_disc,discontinued_last,290,1,4,1981,2007,2007,15,"Series discontinued; backfilled from most recent available year (2007, 15 years from anchor)"
|
||||||
|
use_of_land_cereal_ha,backfill_disc,discontinued_last,290,1,5,1981,2007,2007,15,"Series discontinued; backfilled from most recent available year (2007, 15 years from anchor)"
|
||||||
|
use_of_land_arable_crops_non_cereal_ha,backfill_disc,discontinued_last,290,1,4,1981,2007,2007,15,"Series discontinued; backfilled from most recent available year (2007, 15 years from anchor)"
|
||||||
|
use_of_land_grassland_and_fodders_ha,backfill_disc,discontinued_last,290,1,2,1981,2007,2007,15,"Series discontinued; backfilled from most recent available year (2007, 15 years from anchor)"
|
||||||
|
use_of_land_energy_forest_ha,backfill_disc,discontinued_last,290,1,125,1999,2007,2007,15,"Series discontinued; backfilled from most recent available year (2007, 15 years from anchor)"
|
||||||
|
use_of_land_other_crops_and_fallow_land_ha,backfill_disc,discontinued_last,290,1,3,1981,2007,2007,15,"Series discontinued; backfilled from most recent available year (2007, 15 years from anchor)"
|
||||||
|
social_assistance_number_of_receiver_households,backfill_disc,discontinued_last,290,1,0,1998,2011,2011,11,"Series discontinued; backfilled from most recent available year (2011, 11 years from anchor)"
|
||||||
|
social_assistance_amount_received_tkr,backfill_disc,discontinued_last,290,1,0,1998,2011,2011,11,"Series discontinued; backfilled from most recent available year (2011, 11 years from anchor)"
|
||||||
|
votes_by_party_european_parliament_election_the_june_list,backfill_disc,discontinued_last,290,1,0,2004,2014,2014,8,"Series discontinued; backfilled from most recent available year (2014, 8 years from anchor)"
|
||||||
|
share_of_vote_between_parties_european_parliament_election_the_june_list,backfill_disc,discontinued_last,290,1,0,2004,2014,2014,8,"Series discontinued; backfilled from most recent available year (2014, 8 years from anchor)"
|
||||||
|
workplaces_commuters_coming_into_the_municipality,backfill_disc,discontinued_last,290,1,0,1993,2018,2018,4,"Series discontinued; backfilled from most recent available year (2018, 4 years from anchor)"
|
||||||
|
workplaces_commuters_leaving_the_municipality,backfill_disc,discontinued_last,290,1,0,1993,2018,2018,4,"Series discontinued; backfilled from most recent available year (2018, 4 years from anchor)"
|
||||||
|
workplaces_working_and_living_in_the_municipality,backfill_disc,discontinued_last,290,1,0,1993,2018,2018,4,"Series discontinued; backfilled from most recent available year (2018, 4 years from anchor)"
|
||||||
|
employment_by_gender_men,backfill_disc,discontinued_last,290,1,0,1990,2018,2018,4,"Series discontinued; backfilled from most recent available year (2018, 4 years from anchor)"
|
||||||
|
employment_by_gender_women,backfill_disc,discontinued_last,290,1,0,1990,2018,2018,4,"Series discontinued; backfilled from most recent available year (2018, 4 years from anchor)"
|
||||||
|
concentrations_of_holiday_homes,backfill_window,full_column,290,1,106,2015,2020,2020,2,Entire column backfilled from 2020 (100% missing in 2022)
|
||||||
|
buildings_for_seasonal_use,backfill_window,full_column,290,1,106,2015,2020,2020,2,Entire column backfilled from 2020 (100% missing in 2022)
|
||||||
|
buildings,backfill_window,full_column,290,1,106,2015,2020,2020,2,Entire column backfilled from 2020 (100% missing in 2022)
|
||||||
|
share_of_seasonal_buildings_within_total_buildings,backfill_window,full_column,290,1,106,2015,2020,2020,2,Entire column backfilled from 2020 (100% missing in 2022)
|
||||||
|
land_area_ha,backfill_window,full_column,290,1,106,2015,2020,2020,2,Entire column backfilled from 2020 (100% missing in 2022)
|
||||||
|
proportion_of_area_within_urban_areas,backfill_window,full_column,290,1,106,2015,2020,2020,2,Entire column backfilled from 2020 (100% missing in 2022)
|
||||||
|
open_land,backfill_window,full_column,290,1,0,2015,2020,2020,2,Entire column backfilled from 2020 (100% missing in 2022)
|
||||||
|
forest,backfill_window,full_column,290,1,0,2015,2020,2020,2,Entire column backfilled from 2020 (100% missing in 2022)
|
||||||
|
total_green_space,backfill_window,full_column,290,1,0,2015,2020,2020,2,Entire column backfilled from 2020 (100% missing in 2022)
|
||||||
|
urban_residences_proximity_to_public_green_areas_500_meters_or_less,backfill_window,full_column,290,1,0,2015,2020,2020,2,Entire column backfilled from 2020 (100% missing in 2022)
|
||||||
|
number_of_localities,backfill_window,full_column,290,1,0,2005,2023,2020,2,Entire column backfilled from 2020 (100% missing in 2022)
|
||||||
|
share_of_population_in_localities,backfill_window,full_column,290,1,0,2005,2023,2020,2,Entire column backfilled from 2020 (100% missing in 2022)
|
||||||
|
holiday_home_areas,backfill_window,full_column,290,1,106,2000,2020,2020,2,Entire column backfilled from 2020 (100% missing in 2022)
|
||||||
|
admitted_students_in_higher_vocational_education_women,backfill_window,partial,151,0.5206896551724138,136,2005,2025,2021,1,52.1% missing in 2022; per-municipality fill from ≤2021; 136 municipalities remain NA
|
||||||
|
admitted_students_in_higher_vocational_education_men,backfill_window,partial,150,0.5172413793103449,138,2005,2025,2021,1,51.7% missing in 2022; per-municipality fill from ≤2021; 138 municipalities remain NA
|
||||||
|
graduates_from_higher_vocational_education_women,backfill_window,partial,137,0.4724137931034483,130,2007,2024,2021,1,47.2% missing in 2022; per-municipality fill from ≤2021; 130 municipalities remain NA
|
||||||
|
graduates_from_higher_vocational_education_men,backfill_window,partial,139,0.4793103448275862,132,2007,2024,2021,1,47.9% missing in 2022; per-municipality fill from ≤2021; 132 municipalities remain NA
|
||||||
|
men_s_fertility_rate,backfill_window,partial,11,0.03793103448275862,5,2000,2024,2021,1,3.8% missing in 2022; per-municipality fill from ≤2021; 5 municipalities remain NA
|
||||||
|
women_s_fertility_rate,backfill_window,partial,11,0.03793103448275862,6,2000,2025,2021,1,3.8% missing in 2022; per-municipality fill from ≤2021; 6 municipalities remain NA
|
||||||
|
proportion_of_persons_with_income_support_without_other_remuneration_all_levels_of_education,backfill_window,partial,8,0.027586206896551724,1,1997,2023,2021,1,2.8% missing in 2022; per-municipality fill from ≤2021; 1 municipalities remain NA
|
||||||
|
proportion_of_persons_with_income_support_without_other_remuneration_primary_school,backfill_window,partial,25,0.08620689655172414,13,1997,2023,2021,1,8.6% missing in 2022; per-municipality fill from ≤2021; 13 municipalities remain NA
|
||||||
|
proportion_of_persons_with_income_support_without_other_remuneration_secondary_school,backfill_window,partial,32,0.1103448275862069,18,1997,2023,2021,1,11% missing in 2022; per-municipality fill from ≤2021; 18 municipalities remain NA
|
||||||
|
proportion_of_persons_with_income_support_without_other_remuneration_university,backfill_window,partial,138,0.47586206896551725,115,1997,2023,2021,1,47.6% missing in 2022; per-municipality fill from ≤2021; 115 municipalities remain NA
|
||||||
|
proportion_of_persons_with_income_support_without_other_remuneration_educational_level_missing,backfill_window,partial,177,0.6103448275862069,152,1997,2023,2021,1,61% missing in 2022; per-municipality fill from ≤2021; 152 municipalities remain NA
|
||||||
|
proportion_of_persons_without_income_support_or_introductory_allowance_all_levels_of_education,backfill_window,partial,3,0.010344827586206896,0,1997,2023,2021,1,1% missing in 2022; per-municipality fill from ≤2021; fully resolved
|
||||||
|
proportion_of_persons_without_income_support_or_introductory_allowance_primary_school,backfill_window,partial,3,0.010344827586206896,0,1997,2023,2021,1,1% missing in 2022; per-municipality fill from ≤2021; fully resolved
|
||||||
|
proportion_of_persons_without_income_support_or_introductory_allowance_secondary_school,backfill_window,partial,3,0.010344827586206896,0,1997,2023,2021,1,1% missing in 2022; per-municipality fill from ≤2021; fully resolved
|
||||||
|
proportion_of_persons_without_income_support_or_introductory_allowance_university,backfill_window,partial,3,0.010344827586206896,0,1997,2023,2021,1,1% missing in 2022; per-municipality fill from ≤2021; fully resolved
|
||||||
|
proportion_of_persons_without_income_support_or_introductory_allowance_educational_level_missing,backfill_window,partial,4,0.013793103448275862,0,1997,2023,2021,1,1.4% missing in 2022; per-municipality fill from ≤2021; fully resolved
|
||||||
|
proportion_of_persons_eligible_for_upper_secondary_school,backfill_window,partial,1,0.0034482758620689655,1,1998,2023,2021,1,0.3% missing in 2022; per-municipality fill from ≤2021; 1 municipalities remain NA
|
||||||
|
proportion_of_persons_eligible_for_higher_education,backfill_window,partial,4,0.013793103448275862,0,1997,2023,2021,1,1.4% missing in 2022; per-municipality fill from ≤2021; fully resolved
|
||||||
|
opinion_on_preschool_bad,backfill_window,partial,276,0.9517241379310345,178,2010,2025,2021,1,95.2% missing in 2022; per-municipality fill from ≤2021; 178 municipalities remain NA
|
||||||
|
opinion_on_preschool_good,backfill_window,partial,153,0.5275862068965518,63,2010,2025,2021,1,52.8% missing in 2022; per-municipality fill from ≤2021; 63 municipalities remain NA
|
||||||
|
opinion_on_elementary_school_bad,backfill_window,partial,199,0.6862068965517242,114,2010,2025,2021,1,68.6% missing in 2022; per-municipality fill from ≤2021; 114 municipalities remain NA
|
||||||
|
opinion_on_elementary_school_good,backfill_window,partial,153,0.5275862068965518,63,2010,2025,2021,1,52.8% missing in 2022; per-municipality fill from ≤2021; 63 municipalities remain NA
|
||||||
|
opinion_on_highschool_bad,backfill_window,partial,230,0.7931034482758621,136,2010,2025,2021,1,79.3% missing in 2022; per-municipality fill from ≤2021; 136 municipalities remain NA
|
||||||
|
opinion_on_highschool_good,backfill_window,partial,171,0.5896551724137931,74,2010,2025,2021,1,59% missing in 2022; per-municipality fill from ≤2021; 74 municipalities remain NA
|
||||||
|
opinion_on_elderly_care_bad,backfill_window,partial,162,0.5586206896551724,93,2021,2025,2021,1,55.9% missing in 2022; per-municipality fill from ≤2021; 93 municipalities remain NA
|
||||||
|
opinion_on_elderly_care_good,backfill_window,partial,155,0.5344827586206896,73,2021,2025,2021,1,53.4% missing in 2022; per-municipality fill from ≤2021; 73 municipalities remain NA
|
||||||
|
opinion_on_social_services_support_and_assistance_to_vulnerable_people_bad,backfill_window,partial,161,0.5551724137931034,82,2021,2025,2021,1,55.5% missing in 2022; per-municipality fill from ≤2021; 82 municipalities remain NA
|
||||||
|
opinion_on_social_services_support_and_assistance_to_vulnerable_people_good,backfill_window,partial,172,0.593103448275862,94,2021,2025,2021,1,59.3% missing in 2022; per-municipality fill from ≤2021; 94 municipalities remain NA
|
||||||
|
opinion_on_the_access_to_health_care_reasonable_distance_from_home_very_bad,backfill_window,partial,189,0.6517241379310345,113,2021,2025,2021,1,65.2% missing in 2022; per-municipality fill from ≤2021; 113 municipalities remain NA
|
||||||
|
opinion_on_the_access_to_health_care_reasonable_distance_from_home_bad,backfill_window,partial,154,0.5310344827586206,72,2021,2025,2021,1,53.1% missing in 2022; per-municipality fill from ≤2021; 72 municipalities remain NA
|
||||||
|
opinion_on_the_access_to_health_care_reasonable_distance_from_home_good,backfill_window,partial,153,0.5275862068965518,72,2021,2025,2021,1,52.8% missing in 2022; per-municipality fill from ≤2021; 72 municipalities remain NA
|
||||||
|
opinion_on_the_access_to_health_care_reasonable_distance_from_home_very_good,backfill_window,partial,153,0.5275862068965518,72,2021,2025,2021,1,52.8% missing in 2022; per-municipality fill from ≤2021; 72 municipalities remain NA
|
||||||
|
opinion_on_the_possibility_to_use_the_municipality_s_sports_and_exercise_facilities_very_bad,backfill_window,partial,221,0.7620689655172413,156,2021,2025,2021,1,76.2% missing in 2022; per-municipality fill from ≤2021; 156 municipalities remain NA
|
||||||
|
opinion_on_the_possibility_to_use_the_municipality_s_sports_and_exercise_facilities_bad,backfill_window,partial,153,0.5275862068965518,72,2021,2025,2021,1,52.8% missing in 2022; per-municipality fill from ≤2021; 72 municipalities remain NA
|
||||||
|
opinion_on_the_possibility_to_use_the_municipality_s_sports_and_exercise_facilities_good,backfill_window,partial,153,0.5275862068965518,72,2021,2025,2021,1,52.8% missing in 2022; per-municipality fill from ≤2021; 72 municipalities remain NA
|
||||||
|
opinion_on_the_possibility_to_use_the_municipality_s_sports_and_exercise_facilities_very_good,backfill_window,partial,154,0.5310344827586206,74,2021,2025,2021,1,53.1% missing in 2022; per-municipality fill from ≤2021; 74 municipalities remain NA
|
||||||
|
opinion_on_the_range_of_public_training_places_outdoors_very_bad,backfill_window,partial,167,0.5758620689655173,90,2021,2025,2021,1,57.6% missing in 2022; per-municipality fill from ≤2021; 90 municipalities remain NA
|
||||||
|
opinion_on_the_range_of_public_training_places_outdoors_bad,backfill_window,partial,153,0.5275862068965518,72,2021,2025,2021,1,52.8% missing in 2022; per-municipality fill from ≤2021; 72 municipalities remain NA
|
||||||
|
opinion_on_the_range_of_public_training_places_outdoors_good,backfill_window,partial,153,0.5275862068965518,72,2021,2025,2021,1,52.8% missing in 2022; per-municipality fill from ≤2021; 72 municipalities remain NA
|
||||||
|
opinion_on_the_range_of_public_training_places_outdoors_very_good,backfill_window,partial,155,0.5344827586206896,77,2021,2025,2021,1,53.4% missing in 2022; per-municipality fill from ≤2021; 77 municipalities remain NA
|
||||||
|
share_of_vote_between_parties_riksdag_elections_invalid_ballot_papers,drop,NA,290,1,0,NA,NA,NA,NA,Dropped — no data anywhere in the panel
|
||||||
|
share_of_vote_between_parties_riksdag_elections_non_voters,drop,NA,290,1,0,NA,NA,NA,NA,Dropped — no data anywhere in the panel
|
||||||
|
entitled_to_vote_by_education_level_riksdag_elections_primary_and_lower_secondary_1000s,keep,residual_na,3,0.010344827586206896,3,2018,2022,NA,NA,"3 municipalities (1%) have no 2022 value and no [2020, 2021] data (variable measured only in specific years, e.g. elections)"
|
||||||
|
entitled_to_vote_by_education_level_riksdag_elections_upper_secondary_1000s,keep,residual_na,3,0.010344827586206896,3,2018,2022,NA,NA,"3 municipalities (1%) have no 2022 value and no [2020, 2021] data (variable measured only in specific years, e.g. elections)"
|
||||||
|
entitled_to_vote_by_education_level_riksdag_elections_post_secondary_1000s,keep,residual_na,3,0.010344827586206896,3,2018,2022,NA,NA,"3 municipalities (1%) have no 2022 value and no [2020, 2021] data (variable measured only in specific years, e.g. elections)"
|
||||||
|
entitled_to_vote_by_education_level_riksdag_elections_all_education_levels_1000s,keep,residual_na,3,0.010344827586206896,3,2018,2022,NA,NA,"3 municipalities (1%) have no 2022 value and no [2020, 2021] data (variable measured only in specific years, e.g. elections)"
|
||||||
|
voting_rates_by_education_level_riksdag_elections_primary_and_lower_secondary,keep,residual_na,3,0.010344827586206896,3,2018,2022,NA,NA,"3 municipalities (1%) have no 2022 value and no [2020, 2021] data (variable measured only in specific years, e.g. elections)"
|
||||||
|
voting_rates_by_education_level_riksdag_elections_upper_secondary,keep,residual_na,3,0.010344827586206896,3,2018,2022,NA,NA,"3 municipalities (1%) have no 2022 value and no [2020, 2021] data (variable measured only in specific years, e.g. elections)"
|
||||||
|
voting_rates_by_education_level_riksdag_elections_post_secondary,keep,residual_na,3,0.010344827586206896,3,2018,2022,NA,NA,"3 municipalities (1%) have no 2022 value and no [2020, 2021] data (variable measured only in specific years, e.g. elections)"
|
||||||
|
voting_rates_by_education_level_riksdag_elections_all_education_levels,keep,residual_na,3,0.010344827586206896,3,2018,2022,NA,NA,"3 municipalities (1%) have no 2022 value and no [2020, 2021] data (variable measured only in specific years, e.g. elections)"
|
||||||
|
entitled_to_vote_by_education_level_regional_councils_elections_primary_and_lower_secondary_1000s,keep,residual_na,4,0.013793103448275862,4,2018,2022,NA,NA,"4 municipalities (1.4%) have no 2022 value and no [2020, 2021] data (variable measured only in specific years, e.g. elections)"
|
||||||
|
entitled_to_vote_by_education_level_regional_councils_elections_upper_secondary_1000s,keep,residual_na,4,0.013793103448275862,4,2018,2022,NA,NA,"4 municipalities (1.4%) have no 2022 value and no [2020, 2021] data (variable measured only in specific years, e.g. elections)"
|
||||||
|
entitled_to_vote_by_education_level_regional_councils_elections_post_secondary_1000s,keep,residual_na,4,0.013793103448275862,4,2018,2022,NA,NA,"4 municipalities (1.4%) have no 2022 value and no [2020, 2021] data (variable measured only in specific years, e.g. elections)"
|
||||||
|
entitled_to_vote_by_education_level_regional_councils_elections_all_education_levels_1000s,keep,residual_na,4,0.013793103448275862,4,2018,2022,NA,NA,"4 municipalities (1.4%) have no 2022 value and no [2020, 2021] data (variable measured only in specific years, e.g. elections)"
|
||||||
|
voting_rates_by_education_level_regional_councils_elections_primary_and_lower_secondary,keep,residual_na,4,0.013793103448275862,4,2018,2022,NA,NA,"4 municipalities (1.4%) have no 2022 value and no [2020, 2021] data (variable measured only in specific years, e.g. elections)"
|
||||||
|
voting_rates_by_education_level_regional_councils_elections_upper_secondary,keep,residual_na,4,0.013793103448275862,4,2018,2022,NA,NA,"4 municipalities (1.4%) have no 2022 value and no [2020, 2021] data (variable measured only in specific years, e.g. elections)"
|
||||||
|
voting_rates_by_education_level_regional_councils_elections_post_secondary,keep,residual_na,4,0.013793103448275862,4,2018,2022,NA,NA,"4 municipalities (1.4%) have no 2022 value and no [2020, 2021] data (variable measured only in specific years, e.g. elections)"
|
||||||
|
voting_rates_by_education_level_regional_councils_elections_all_education_levels,keep,residual_na,4,0.013793103448275862,4,2018,2022,NA,NA,"4 municipalities (1.4%) have no 2022 value and no [2020, 2021] data (variable measured only in specific years, e.g. elections)"
|
||||||
|
births,keep,NA,0,0,0,1968,2025,NA,NA,Complete in 2022
|
||||||
|
age_0_9_years,keep,NA,0,0,0,1978,2024,NA,NA,Complete in 2022
|
||||||
|
age_10_19_years,keep,NA,0,0,0,1978,2024,NA,NA,Complete in 2022
|
||||||
|
age_20_29_years,keep,NA,0,0,0,1978,2024,NA,NA,Complete in 2022
|
||||||
|
age_30_39_years,keep,NA,0,0,0,1978,2024,NA,NA,Complete in 2022
|
||||||
|
age_40_49_years,keep,NA,0,0,0,1978,2024,NA,NA,Complete in 2022
|
||||||
|
age_50_59_years,keep,NA,0,0,0,1978,2024,NA,NA,Complete in 2022
|
||||||
|
age_60_69_years,keep,NA,0,0,0,1978,2024,NA,NA,Complete in 2022
|
||||||
|
age_70_79_years,keep,NA,0,0,0,1978,2024,NA,NA,Complete in 2022
|
||||||
|
age_80_89_years,keep,NA,0,0,0,1978,2024,NA,NA,Complete in 2022
|
||||||
|
age_90_99_years,keep,NA,0,0,0,1978,2024,NA,NA,Complete in 2022
|
||||||
|
age_100_years,keep,NA,0,0,0,1978,2024,NA,NA,Complete in 2022
|
||||||
|
sex_men,keep,NA,0,0,0,1968,2024,NA,NA,Complete in 2022
|
||||||
|
sex_women,keep,NA,0,0,0,1968,2024,NA,NA,Complete in 2022
|
||||||
|
population,keep,NA,0,0,0,1968,2024,NA,NA,Complete in 2022
|
||||||
|
deaths,keep,NA,0,0,0,1968,2024,NA,NA,Complete in 2022
|
||||||
|
mean_income,keep,NA,0,0,0,1999,2024,NA,NA,Complete in 2022
|
||||||
|
median_income,keep,NA,0,0,0,1999,2024,NA,NA,Complete in 2022
|
||||||
|
final_tax,keep,NA,0,0,0,2000,2024,NA,NA,Complete in 2022
|
||||||
|
education_level_primary_and_secondary,keep,NA,0,0,0,1985,2024,NA,NA,Complete in 2022
|
||||||
|
education_level_upper_secondary,keep,NA,0,0,0,1985,2024,NA,NA,Complete in 2022
|
||||||
|
education_level_post_secondary,keep,NA,0,0,0,1985,2024,NA,NA,Complete in 2022
|
||||||
|
education_level_post_graduate,keep,NA,0,0,0,1985,2024,NA,NA,Complete in 2022
|
||||||
|
employment_by_activity_sectors_agriculture_forestry_hunting_and_fishing,keep,NA,0,0,0,1993,2024,NA,NA,Complete in 2022
|
||||||
|
employment_by_activity_sectors_mining_quarrying_and_manufacturing,keep,NA,0,0,0,1993,2024,NA,NA,Complete in 2022
|
||||||
|
employment_by_activity_sectors_electricity_gas_and_water_supply_refuse_disposal,keep,NA,0,0,0,1993,2024,NA,NA,Complete in 2022
|
||||||
|
employment_by_activity_sectors_construction,keep,NA,0,0,0,1993,2024,NA,NA,Complete in 2022
|
||||||
|
employment_by_activity_sectors_wholesale_and_retail_trade_transport_storage_and_warehousing_post_and_telecommunications,keep,NA,0,0,0,1993,2024,NA,NA,Complete in 2022
|
||||||
|
employment_by_activity_sectors_personal_and_cultural_service_activities,keep,NA,0,0,0,1993,2024,NA,NA,Complete in 2022
|
||||||
|
employment_by_activity_sectors_financial_institutions_real_estate_activities_business_activities,keep,NA,0,0,0,1993,2024,NA,NA,Complete in 2022
|
||||||
|
employment_by_activity_sectors_public_authorities_national_defence_extra_territorial_organizations,keep,NA,0,0,0,1993,2024,NA,NA,Complete in 2022
|
||||||
|
employment_by_activity_sectors_research_and_development_education,keep,NA,0,0,0,1993,2024,NA,NA,Complete in 2022
|
||||||
|
employment_by_activity_sectors_health_and_social_work_establishments,keep,NA,0,0,0,1993,2024,NA,NA,Complete in 2022
|
||||||
|
employment_by_activity_sectors_major_groups_missing,keep,NA,0,0,0,1993,2024,NA,NA,Complete in 2022
|
||||||
|
adult_students_upper_secondary_education,keep,NA,0,0,0,1993,2024,NA,NA,Complete in 2022
|
||||||
|
adult_students_municipal_adult_education,keep,NA,0,0,0,1993,2024,NA,NA,Complete in 2022
|
||||||
|
adult_students_higher_education,keep,NA,0,0,0,1993,2024,NA,NA,Complete in 2022
|
||||||
|
adult_students_other_students,keep,NA,0,0,0,1993,2024,NA,NA,Complete in 2022
|
||||||
|
adult_students_non_students,keep,NA,0,0,0,1993,2024,NA,NA,Complete in 2022
|
||||||
|
marriages,keep,NA,0,0,0,2000,2025,NA,NA,Complete in 2022
|
||||||
|
divorces,keep,NA,0,0,0,2000,2025,NA,NA,Complete in 2022
|
||||||
|
elected_members_by_party_municipal_councils_the_moderate_party,keep,NA,0,0,0,1982,2022,NA,NA,Complete in 2022
|
||||||
|
elected_members_by_party_municipal_councils_the_centre_party,keep,NA,0,0,0,1982,2022,NA,NA,Complete in 2022
|
||||||
|
elected_members_by_party_municipal_councils_the_liberal_party,keep,NA,0,0,0,1982,2022,NA,NA,Complete in 2022
|
||||||
|
elected_members_by_party_municipal_councils_the_christian_democratic_party,keep,NA,0,0,0,1982,2022,NA,NA,Complete in 2022
|
||||||
|
elected_members_by_party_municipal_councils_the_green_party,keep,NA,0,0,0,1982,2022,NA,NA,Complete in 2022
|
||||||
|
elected_members_by_party_municipal_councils_the_social_democratic_party,keep,NA,0,0,0,1982,2022,NA,NA,Complete in 2022
|
||||||
|
elected_members_by_party_municipal_councils_the_left_party,keep,NA,0,0,0,1982,2022,NA,NA,Complete in 2022
|
||||||
|
elected_members_by_party_municipal_councils_the_sweden_democrats,keep,NA,0,0,0,1982,2022,NA,NA,Complete in 2022
|
||||||
|
elected_members_by_party_municipal_councils_other_parties,keep,NA,0,0,0,1982,2022,NA,NA,Complete in 2022
|
||||||
|
votes_by_party_riksdag_elections_the_moderate_party,keep,NA,0,0,0,1973,2022,NA,NA,Complete in 2022
|
||||||
|
votes_by_party_riksdag_elections_the_centre_party,keep,NA,0,0,0,1973,2022,NA,NA,Complete in 2022
|
||||||
|
votes_by_party_riksdag_elections_the_liberal_party,keep,NA,0,0,0,1973,2022,NA,NA,Complete in 2022
|
||||||
|
votes_by_party_riksdag_elections_the_christian_democratic_party,keep,NA,0,0,0,1973,2022,NA,NA,Complete in 2022
|
||||||
|
votes_by_party_riksdag_elections_the_green_party,keep,NA,0,0,0,1982,2022,NA,NA,Complete in 2022
|
||||||
|
votes_by_party_riksdag_elections_the_social_democratic_party,keep,NA,0,0,0,1973,2022,NA,NA,Complete in 2022
|
||||||
|
votes_by_party_riksdag_elections_the_left_party,keep,NA,0,0,0,1973,2022,NA,NA,Complete in 2022
|
||||||
|
votes_by_party_riksdag_elections_the_sweden_democrats,keep,NA,0,0,0,1998,2022,NA,NA,Complete in 2022
|
||||||
|
votes_by_party_riksdag_elections_other_parties,keep,NA,0,0,0,1973,2022,NA,NA,Complete in 2022
|
||||||
|
votes_by_party_riksdag_elections_invalid_ballot_papers,keep,NA,0,0,0,1973,2022,NA,NA,Complete in 2022
|
||||||
|
votes_by_party_riksdag_elections_non_voters,keep,NA,0,0,0,1973,2022,NA,NA,Complete in 2022
|
||||||
|
share_of_vote_between_parties_riksdag_elections_the_moderate_party,keep,NA,0,0,0,1973,2022,NA,NA,Complete in 2022
|
||||||
|
share_of_vote_between_parties_riksdag_elections_the_centre_party,keep,NA,0,0,0,1973,2022,NA,NA,Complete in 2022
|
||||||
|
share_of_vote_between_parties_riksdag_elections_the_liberal_party,keep,NA,0,0,0,1973,2022,NA,NA,Complete in 2022
|
||||||
|
share_of_vote_between_parties_riksdag_elections_the_christian_democratic_party,keep,NA,0,0,0,1973,2022,NA,NA,Complete in 2022
|
||||||
|
share_of_vote_between_parties_riksdag_elections_the_green_party,keep,NA,0,0,0,1982,2022,NA,NA,Complete in 2022
|
||||||
|
share_of_vote_between_parties_riksdag_elections_the_social_democratic_party,keep,NA,0,0,0,1973,2022,NA,NA,Complete in 2022
|
||||||
|
share_of_vote_between_parties_riksdag_elections_the_left_party,keep,NA,0,0,0,1973,2022,NA,NA,Complete in 2022
|
||||||
|
share_of_vote_between_parties_riksdag_elections_the_sweden_democrats,keep,NA,0,0,0,1998,2022,NA,NA,Complete in 2022
|
||||||
|
share_of_vote_between_parties_riksdag_elections_other_parties,keep,NA,0,0,0,1973,2022,NA,NA,Complete in 2022
|
||||||
|
education_level_of_swedish_men_primary_and_secondary,keep,NA,0,0,0,1985,2024,NA,NA,Complete in 2022
|
||||||
|
education_level_of_swedish_men_upper_secondary,keep,NA,0,0,0,1985,2024,NA,NA,Complete in 2022
|
||||||
|
education_level_of_swedish_men_post_secondary,keep,NA,0,0,0,1985,2024,NA,NA,Complete in 2022
|
||||||
|
education_level_of_swedish_men_post_graduate,keep,NA,0,0,0,1985,2024,NA,NA,Complete in 2022
|
||||||
|
education_level_of_swedish_women_primary_and_secondary,keep,NA,0,0,0,1985,2024,NA,NA,Complete in 2022
|
||||||
|
education_level_of_swedish_women_upper_secondary,keep,NA,0,0,0,1985,2024,NA,NA,Complete in 2022
|
||||||
|
education_level_of_swedish_women_post_secondary,keep,NA,0,0,0,1985,2024,NA,NA,Complete in 2022
|
||||||
|
education_level_of_swedish_women_post_graduate_education,keep,NA,0,0,0,1985,2024,NA,NA,Complete in 2022
|
||||||
|
location_of_home_vs_university_upper_secondary_same_municipality,keep,NA,0,0,0,1999,2024,NA,NA,Complete in 2022
|
||||||
|
location_of_home_vs_university_upper_secondary_studying_in_other_municipality_same_county,keep,NA,0,0,0,1999,2024,NA,NA,Complete in 2022
|
||||||
|
location_of_home_vs_university_upper_secondary_studying_outside_the_county_of_residence,keep,NA,0,0,0,1999,2024,NA,NA,Complete in 2022
|
||||||
|
location_of_home_vs_university_municipal_adult_education_same_municipality,keep,NA,0,0,0,1999,2024,NA,NA,Complete in 2022
|
||||||
|
location_of_home_vs_university_municipal_adult_education_studying_in_other_municipality_same_county,keep,NA,0,0,0,1999,2024,NA,NA,Complete in 2022
|
||||||
|
location_of_home_vs_university_municipal_adult_education_studying_outside_the_county_of_residence,keep,NA,0,0,0,1999,2024,NA,NA,Complete in 2022
|
||||||
|
location_of_home_vs_university_higher_education_same_municipality,keep,NA,0,0,0,1999,2024,NA,NA,Complete in 2022
|
||||||
|
location_of_home_vs_university_higher_education_studying_in_other_municipality_same_county,keep,NA,0,0,0,1999,2024,NA,NA,Complete in 2022
|
||||||
|
location_of_home_vs_university_higher_education_studying_outside_the_county_of_residence,keep,NA,0,0,0,1999,2024,NA,NA,Complete in 2022
|
||||||
|
inland_water_excluding_the_four_large_lakes_square_kilometers,keep,NA,0,0,0,2000,2026,NA,NA,Complete in 2022
|
||||||
|
the_four_large_lakes_square_kilometers,keep,NA,0,0,0,2000,2026,NA,NA,Complete in 2022
|
||||||
|
seawater_square_kilometers,keep,NA,0,0,0,2000,2026,NA,NA,Complete in 2022
|
||||||
|
proportion_of_students,keep,NA,0,0,0,1997,2023,NA,NA,Complete in 2022
|
||||||
|
opinion_on_preschool_mid,keep,NA,0,0,0,2010,2025,NA,NA,Complete in 2022
|
||||||
|
opinion_on_elementary_school_mid,keep,NA,0,0,0,2010,2025,NA,NA,Complete in 2022
|
||||||
|
opinion_on_highschool_mid,keep,NA,0,0,0,2010,2025,NA,NA,Complete in 2022
|
||||||
|
opinion_on_elderly_care_mid,keep,NA,0,0,0,2021,2025,NA,NA,Complete in 2022
|
||||||
|
opinion_on_social_services_support_and_assistance_to_vulnerable_people_mid,keep,NA,0,0,0,2021,2025,NA,NA,Complete in 2022
|
||||||
|
sickness_rate_number_of_days,keep,NA,0,0,0,1997,2023,NA,NA,Complete in 2022
|
||||||
|
proportion_of_persons_who_contribute_to_the_sickness_rate,keep,NA,0,0,0,1997,2023,NA,NA,Complete in 2022
|
||||||
|
number_of_rented_dwellings_by_type_of_building_one_or_two_dwelling_buildings,keep,NA,0,0,0,1990,2025,NA,NA,Complete in 2022
|
||||||
|
number_of_rented_dwellings_by_type_of_building_multi_dwelling_buildings,keep,NA,0,0,0,1990,2025,NA,NA,Complete in 2022
|
||||||
|
number_of_rented_dwellings_by_type_of_building_other_buildings,keep,NA,0,0,0,1990,2025,NA,NA,Complete in 2022
|
||||||
|
number_of_rented_dwellings_by_type_of_building_special_housing,keep,NA,0,0,0,1990,2025,NA,NA,Complete in 2022
|
||||||
|
number_of_tenant_owned_dwellings_by_type_of_building_one_or_two_dwelling_buildings,keep,NA,0,0,0,1990,2025,NA,NA,Complete in 2022
|
||||||
|
number_of_tenant_owned_dwellings_by_type_of_building_multi_dwelling_buildings,keep,NA,0,0,0,1990,2025,NA,NA,Complete in 2022
|
||||||
|
number_of_tenant_owned_dwellings_by_type_of_building_other_buildings,keep,NA,0,0,0,1990,2025,NA,NA,Complete in 2022
|
||||||
|
number_of_tenant_owned_dwellings_by_type_of_building_special_housing,keep,NA,0,0,0,1990,2025,NA,NA,Complete in 2022
|
||||||
|
number_of_owner_occupied_dwellings_by_type_of_building_one_or_two_dwelling_buildings,keep,NA,0,0,0,1990,2025,NA,NA,Complete in 2022
|
||||||
|
number_of_owner_occupied_dwellings_by_type_of_building_multi_dwelling_buildings,keep,NA,0,0,0,1990,2025,NA,NA,Complete in 2022
|
||||||
|
number_of_owner_occupied_dwellings_by_type_of_building_other_buildings,keep,NA,0,0,0,1990,2025,NA,NA,Complete in 2022
|
||||||
|
number_of_owner_occupied_dwellings_by_type_of_building_special_housing,keep,NA,0,0,0,1990,2025,NA,NA,Complete in 2022
|
||||||
|
number_of_registered_passenger_cars_by_status_in_use,keep,NA,0,0,0,2015,2025,NA,NA,Complete in 2022
|
||||||
|
number_of_registered_passenger_cars_by_status_not_in_use,keep,NA,0,0,0,2015,2025,NA,NA,Complete in 2022
|
||||||
|
number_of_registered_passenger_cars_by_status_total,keep,NA,0,0,0,2015,2025,NA,NA,Complete in 2022
|
||||||
|
number_of_persons_per_household,keep,NA,0,0,0,2011,2025,NA,NA,Complete in 2022
|
||||||
|
number_of_inmigrations,keep,NA,0,0,0,1997,2025,NA,NA,Complete in 2022
|
||||||
|
number_of_outmigrations,keep,NA,0,0,0,1997,2025,NA,NA,Complete in 2022
|
||||||
|
birth_country_born_in_sweden,keep,NA,0,0,0,2000,2025,NA,NA,Complete in 2022
|
||||||
|
birth_country_foreign_born,keep,NA,0,0,0,2000,2025,NA,NA,Complete in 2022
|
||||||
|
mean_tax_rate,keep,NA,0,0,0,1993,2026,NA,NA,Complete in 2022
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# 00-Libraries -------------------------------------------
|
# 00-Libraries -----------------------------------------------------------------
|
||||||
library(tidyverse)
|
library(tidyverse)
|
||||||
library(readxl)
|
library(readxl)
|
||||||
|
|
||||||
# 01-Import ----------------------------------------------
|
# 01-Import --------------------------------------------------------------------
|
||||||
|
|
||||||
# Municipalities_db.xlsx has two title rows before the merged-cell header:
|
# Municipalities_db.xlsx has two title rows before the merged-cell header:
|
||||||
# Row 1: "Municipalities Database" (title)
|
# Row 1: "Municipalities Database" (title)
|
||||||
|
|
@ -11,6 +11,7 @@ library(readxl)
|
||||||
# Row 4: sub-category names
|
# Row 4: sub-category names
|
||||||
# Row 5+: data
|
# Row 5+: data
|
||||||
|
|
||||||
|
# I first extract the categories and subcategories
|
||||||
header_rows <- read_xlsx(
|
header_rows <- read_xlsx(
|
||||||
"data/Municipalities_db.xlsx",
|
"data/Municipalities_db.xlsx",
|
||||||
col_names = FALSE,
|
col_names = FALSE,
|
||||||
|
|
@ -18,6 +19,7 @@ header_rows <- read_xlsx(
|
||||||
skip = 2
|
skip = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Then, I reshape it as a list using a "category_subcategory" format
|
||||||
col_names <- header_rows |>
|
col_names <- header_rows |>
|
||||||
t() |>
|
t() |>
|
||||||
as_tibble(.name_repair = "unique") |>
|
as_tibble(.name_repair = "unique") |>
|
||||||
|
|
@ -35,6 +37,7 @@ col_names <- header_rows |>
|
||||||
) |>
|
) |>
|
||||||
pull(col_name)
|
pull(col_name)
|
||||||
|
|
||||||
|
# Finally, I read the table skiping the first for rows and then append col_names
|
||||||
municipalities_raw <- read_xlsx(
|
municipalities_raw <- read_xlsx(
|
||||||
"data/Municipalities_db.xlsx",
|
"data/Municipalities_db.xlsx",
|
||||||
skip = 4,
|
skip = 4,
|
||||||
|
|
@ -43,4 +46,5 @@ municipalities_raw <- read_xlsx(
|
||||||
) |>
|
) |>
|
||||||
mutate(across(-c(code, municipality), \(x) suppressWarnings(as.numeric(x))))
|
mutate(across(-c(code, municipality), \(x) suppressWarnings(as.numeric(x))))
|
||||||
|
|
||||||
|
# Write out as rds for future reading
|
||||||
write_rds(municipalities_raw, "data/processed/m_raw.rds")
|
write_rds(municipalities_raw, "data/processed/m_raw.rds")
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,309 @@
|
||||||
# 01-Read ----------------------------------------------------------------------
|
# =============================================================================
|
||||||
|
# 01-sampling.R · 2022 cross-section for municipalities CA
|
||||||
|
# =============================================================================
|
||||||
|
#
|
||||||
|
# Takes the full dataset (1968–2026, 290 municipalities) and produces a single
|
||||||
|
# clean cross-section anchored to 2022.
|
||||||
|
#
|
||||||
|
# Each variable is assigned one of five actions:
|
||||||
|
#
|
||||||
|
# keep complete (or near-complete) in 2022; used as-is.
|
||||||
|
# Variables with a handful of NAs and no backfill data
|
||||||
|
# (e.g. election variables, 3-4 missing per cycle)
|
||||||
|
# are also kept; residual NAs are noted in the audit.
|
||||||
|
#
|
||||||
|
# backfill_window missing in 2022 (fully or partially), but data exist
|
||||||
|
# in [2020, 2021]: fill each municipality from its most
|
||||||
|
# recent non-NA value in that window.
|
||||||
|
#
|
||||||
|
# backfill_census 100% missing in 2022, but the series is still active
|
||||||
|
# (data exists AFTER 2022, i.e. a periodic/census
|
||||||
|
# variable such as EU parliament elections).
|
||||||
|
# Strategy: use the year closest to 2022, looking both
|
||||||
|
# backwards and forwards.
|
||||||
|
#
|
||||||
|
# backfill_disc 100% missing in 2022, and the series was discontinued
|
||||||
|
# before 2022 (data only exists in the past).
|
||||||
|
# Strategy: use the most recent available year for each
|
||||||
|
# municipality, regardless of how long ago it was.
|
||||||
|
#
|
||||||
|
# drop no data at all in the full panel; excluded.
|
||||||
|
#
|
||||||
|
# Outputs:
|
||||||
|
# data/processed/m_sample.rds : 290 municipalities × retained variables
|
||||||
|
# data/processed/sampling_audit.csv : variable-level audit log
|
||||||
|
|
||||||
|
library(tidyverse)
|
||||||
|
|
||||||
|
# 00-Load ----------------------------------------------------------------------
|
||||||
municipalities_raw <- read_rds("data/processed/m_raw.rds")
|
municipalities_raw <- read_rds("data/processed/m_raw.rds")
|
||||||
|
# Panel: 17 110 rows (290 municipalities × ~59 years), 257 columns.
|
||||||
|
|
||||||
|
# 01-Characterise each variable's availability ---------------------------------
|
||||||
|
# 1a. Full dataset: first and last year with any non-NA value.
|
||||||
|
availability_full <- municipalities_raw |>
|
||||||
|
pivot_longer(
|
||||||
|
cols = -c(year, code, municipality),
|
||||||
|
names_to = "variable",
|
||||||
|
values_to = "value"
|
||||||
|
) |>
|
||||||
|
filter(!is.na(value)) |>
|
||||||
|
summarise(
|
||||||
|
.by = variable,
|
||||||
|
first_year = min(year),
|
||||||
|
last_year = max(year)
|
||||||
|
)
|
||||||
|
|
||||||
|
# 1b. Backfill window [2020, 2021]: the most recent year with any non-NA value.
|
||||||
|
# If a variable has nothing here, the window-backfill path is unavailable.
|
||||||
|
availability_window <- municipalities_raw |>
|
||||||
|
filter(between(year, 2020, 2021)) |>
|
||||||
|
pivot_longer(
|
||||||
|
cols = -c(year, code, municipality),
|
||||||
|
names_to = "variable",
|
||||||
|
values_to = "value"
|
||||||
|
) |>
|
||||||
|
filter(!is.na(value)) |>
|
||||||
|
summarise(
|
||||||
|
.by = variable,
|
||||||
|
window_last_year = max(year)
|
||||||
|
)
|
||||||
|
|
||||||
|
# 02-Extract the 2022 slice and assess NAs -------------------------------------
|
||||||
|
m_2022 <- municipalities_raw |> filter(year == 2022)
|
||||||
|
n_munic <- nrow(m_2022) # 290
|
||||||
|
|
||||||
|
na_2022 <- m_2022 |>
|
||||||
|
summarise(across(-c(year, code, municipality), \(x) sum(is.na(x)))) |>
|
||||||
|
pivot_longer(everything(), names_to = "variable", values_to = "n_na") |>
|
||||||
|
mutate(pct_na = n_na / n_munic)
|
||||||
|
|
||||||
|
# 03-Classify every variable ---------------------------------------------------
|
||||||
|
variable_plan <- na_2022 |>
|
||||||
|
left_join(availability_full, by = "variable") |>
|
||||||
|
left_join(availability_window, by = "variable") |>
|
||||||
|
mutate(
|
||||||
|
action = case_when(
|
||||||
|
# Already fine in 2022 (including partial NAs with no window fill available)
|
||||||
|
n_na == 0 ~ "keep",
|
||||||
|
n_na > 0 & n_na < n_munic & is.na(window_last_year) ~ "keep",
|
||||||
|
|
||||||
|
# Gap in 2022 but window data available; standard window backfill
|
||||||
|
n_na > 0 & !is.na(window_last_year) ~ "backfill_window",
|
||||||
|
|
||||||
|
# Fully missing in 2022 series is still active (data after 2022); periodic
|
||||||
|
n_na == n_munic &
|
||||||
|
is.na(window_last_year) &
|
||||||
|
!is.na(last_year) &
|
||||||
|
last_year > 2022 ~ "backfill_census",
|
||||||
|
|
||||||
|
# Fully missing in 2022; series ended before 2022; discontinued
|
||||||
|
n_na == n_munic &
|
||||||
|
is.na(window_last_year) &
|
||||||
|
!is.na(last_year) &
|
||||||
|
last_year <= 2022 ~ "backfill_disc",
|
||||||
|
|
||||||
|
# No data anywhere in the dataset
|
||||||
|
is.na(last_year) ~ "drop"
|
||||||
|
),
|
||||||
|
# Sub-type for reporting
|
||||||
|
fill_type = case_when(
|
||||||
|
action == "backfill_window" & n_na == n_munic ~ "full_column",
|
||||||
|
action == "backfill_window" & n_na < n_munic ~ "partial",
|
||||||
|
action == "keep" & n_na > 0 ~ "residual_na",
|
||||||
|
action == "backfill_census" ~ "census_closest",
|
||||||
|
action == "backfill_disc" ~ "discontinued_last",
|
||||||
|
TRUE ~ NA_character_
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
# 04-Backfill A: window [2020, 2021] Per-municipality, most recent non-NA value.
|
||||||
|
vars_window <- variable_plan |>
|
||||||
|
filter(action == "backfill_window") |>
|
||||||
|
pull(variable)
|
||||||
|
|
||||||
|
window_long <- municipalities_raw |>
|
||||||
|
filter(between(year, 2020, 2021)) |>
|
||||||
|
select(year, code, all_of(vars_window)) |>
|
||||||
|
pivot_longer(
|
||||||
|
all_of(vars_window),
|
||||||
|
names_to = "variable",
|
||||||
|
values_to = "value"
|
||||||
|
) |>
|
||||||
|
filter(!is.na(value)) |>
|
||||||
|
group_by(code, variable) |>
|
||||||
|
slice_max(year, n = 1, with_ties = FALSE) |>
|
||||||
|
ungroup()
|
||||||
|
|
||||||
|
window_source_year <- window_long |>
|
||||||
|
group_by(variable) |>
|
||||||
|
summarise(source_year = max(year), .groups = "drop")
|
||||||
|
|
||||||
|
window_wide <- window_long |>
|
||||||
|
select(-year) |>
|
||||||
|
pivot_wider(names_from = variable, values_from = value)
|
||||||
|
|
||||||
|
# 05-Backfill B: census / periodic Per-municipality, year closest to 2022 in
|
||||||
|
# either direction.
|
||||||
|
# (Applies to EU parliament election variables: 2024 is 2 years away,
|
||||||
|
# 2019 is 3 years away, so 2024 will be selected for all municipalities.)
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
vars_census <- variable_plan |>
|
||||||
|
filter(action == "backfill_census") |>
|
||||||
|
pull(variable)
|
||||||
|
|
||||||
|
census_long <- municipalities_raw |>
|
||||||
|
filter(year != 2022) |>
|
||||||
|
select(year, code, all_of(vars_census)) |>
|
||||||
|
pivot_longer(
|
||||||
|
all_of(vars_census),
|
||||||
|
names_to = "variable",
|
||||||
|
values_to = "value"
|
||||||
|
) |>
|
||||||
|
filter(!is.na(value)) |>
|
||||||
|
mutate(distance = abs(year - 2022)) |>
|
||||||
|
group_by(code, variable) |>
|
||||||
|
slice_min(distance, n = 1, with_ties = FALSE) |>
|
||||||
|
ungroup()
|
||||||
|
|
||||||
|
census_source_year <- census_long |>
|
||||||
|
group_by(variable) |>
|
||||||
|
summarise(source_year = max(year), .groups = "drop")
|
||||||
|
|
||||||
|
census_wide <- census_long |>
|
||||||
|
select(-year, -distance) |>
|
||||||
|
pivot_wider(names_from = variable, values_from = value)
|
||||||
|
|
||||||
|
# 06-Backfill C: discontinued --------------------------------------------------
|
||||||
|
vars_disc <- variable_plan |>
|
||||||
|
filter(action == "backfill_disc") |>
|
||||||
|
pull(variable)
|
||||||
|
|
||||||
|
disc_long <- municipalities_raw |>
|
||||||
|
filter(year < 2022) |>
|
||||||
|
select(year, code, all_of(vars_disc)) |>
|
||||||
|
pivot_longer(all_of(vars_disc), names_to = "variable", values_to = "value") |>
|
||||||
|
filter(!is.na(value)) |>
|
||||||
|
group_by(code, variable) |>
|
||||||
|
slice_max(year, n = 1, with_ties = FALSE) |>
|
||||||
|
ungroup()
|
||||||
|
|
||||||
|
disc_source_year <- disc_long |>
|
||||||
|
group_by(variable) |>
|
||||||
|
summarise(source_year = max(year), .groups = "drop")
|
||||||
|
|
||||||
|
disc_wide <- disc_long |>
|
||||||
|
select(-year) |>
|
||||||
|
pivot_wider(names_from = variable, values_from = value)
|
||||||
|
|
||||||
|
# 07-Apply all fills (window first, then census and disc which only touch the
|
||||||
|
# still-NA cells, i.e. the 100%-missing variables ------------------------------
|
||||||
|
m_2022_filled <- m_2022 |>
|
||||||
|
rows_patch(window_wide, by = "code", unmatched = "ignore") |>
|
||||||
|
rows_patch(census_wide, by = "code", unmatched = "ignore") |>
|
||||||
|
rows_patch(disc_wide, by = "code", unmatched = "ignore")
|
||||||
|
|
||||||
|
# 08-Remove truly empty variables and the redundant year column ----------------
|
||||||
|
vars_drop <- variable_plan |> filter(action == "drop") |> pull(variable)
|
||||||
|
|
||||||
|
m_sample <- m_2022_filled |>
|
||||||
|
select(-all_of(vars_drop), -year)
|
||||||
|
|
||||||
|
# Check residual NAs
|
||||||
|
na_remaining <- m_sample |>
|
||||||
|
summarise(across(-c(code, municipality), \(x) sum(is.na(x)))) |>
|
||||||
|
pivot_longer(everything(), names_to = "variable", values_to = "n_na_final") |>
|
||||||
|
filter(n_na_final > 0)
|
||||||
|
|
||||||
|
# 09-Audit ---------------------------------------------------------------------
|
||||||
|
# Combine source-year info from all three fill paths
|
||||||
|
source_years <- bind_rows(
|
||||||
|
window_source_year,
|
||||||
|
census_source_year,
|
||||||
|
disc_source_year
|
||||||
|
)
|
||||||
|
|
||||||
|
sampling_audit <- variable_plan |>
|
||||||
|
left_join(source_years, by = "variable") |>
|
||||||
|
left_join(na_remaining, by = "variable") |>
|
||||||
|
mutate(
|
||||||
|
n_na_final = replace_na(n_na_final, 0L),
|
||||||
|
years_from_2022 = if_else(
|
||||||
|
!is.na(source_year),
|
||||||
|
abs(source_year - 2022L),
|
||||||
|
NA_integer_
|
||||||
|
),
|
||||||
|
note = case_when(
|
||||||
|
action == "keep" & is.na(fill_type) ~
|
||||||
|
"Complete in 2022",
|
||||||
|
|
||||||
|
fill_type == "residual_na" ~
|
||||||
|
paste0(
|
||||||
|
n_na,
|
||||||
|
" municipalities (",
|
||||||
|
round(pct_na * 100, 1),
|
||||||
|
"%) have no 2022 value ",
|
||||||
|
"and no [2020, 2021] data (variable measured only in specific years, e.g. elections)"
|
||||||
|
),
|
||||||
|
|
||||||
|
action == "drop" ~
|
||||||
|
"Dropped — no data anywhere in the panel",
|
||||||
|
|
||||||
|
fill_type == "full_column" ~
|
||||||
|
paste0(
|
||||||
|
"Entire column backfilled from ",
|
||||||
|
source_year,
|
||||||
|
" (100% missing in 2022)"
|
||||||
|
),
|
||||||
|
|
||||||
|
fill_type == "partial" ~
|
||||||
|
paste0(
|
||||||
|
round(pct_na * 100, 1),
|
||||||
|
"% missing in 2022; ",
|
||||||
|
"per-municipality fill from ≤",
|
||||||
|
source_year,
|
||||||
|
if_else(
|
||||||
|
n_na_final > 0,
|
||||||
|
paste0("; ", n_na_final, " municipalities remain NA"),
|
||||||
|
"; fully resolved"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
|
||||||
|
fill_type == "census_closest" ~
|
||||||
|
paste0(
|
||||||
|
"Periodic variable — no data in 2022; backfilled from ",
|
||||||
|
source_year,
|
||||||
|
" (",
|
||||||
|
years_from_2022,
|
||||||
|
" years from anchor)"
|
||||||
|
),
|
||||||
|
|
||||||
|
fill_type == "discontinued_last" ~
|
||||||
|
paste0(
|
||||||
|
"Series discontinued; backfilled from most recent available year (",
|
||||||
|
source_year,
|
||||||
|
", ",
|
||||||
|
years_from_2022,
|
||||||
|
" years from anchor)"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) |>
|
||||||
|
select(
|
||||||
|
variable,
|
||||||
|
action,
|
||||||
|
fill_type,
|
||||||
|
n_na_2022 = n_na,
|
||||||
|
pct_na_2022 = pct_na,
|
||||||
|
n_na_final,
|
||||||
|
first_year,
|
||||||
|
last_year,
|
||||||
|
source_year,
|
||||||
|
years_from_2022,
|
||||||
|
note
|
||||||
|
) |>
|
||||||
|
arrange(action, fill_type, desc(years_from_2022))
|
||||||
|
|
||||||
|
|
||||||
|
# 10-Save ----------------------------------------------------------------------
|
||||||
|
write_rds(m_sample, "data/processed/m_sample.rds")
|
||||||
|
write_csv(sampling_audit, "data/processed/sampling_audit.csv")
|
||||||
|
|
|
||||||
12
txt/qrm-2026.md
Normal file
12
txt/qrm-2026.md
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
# The Spaces of Municipalities and Regions in Sweden and the Distribution of Educational Assets
|
||||||
|
|
||||||
|
Mikael Börjesson, Pablo Lillo Cea, Laura Giorio, Laureline Brun, and Clara Comte
|
||||||
|
HERO, Uppsala University
|
||||||
|
|
||||||
|
The responsibility for providing and running preschools, compulsory education and upper secondary education is blended, but the municipalities take the largest part. They care for the education of the majority of children up to 19 years of age, and in many cases, there are few private options. They raise the funds through taxes, employ the staff, build and maintain the facilities, and plan and develop the educational provision. However, the conditions for taking on such responsibility vary substantially. The smallest municipalities amount to just above 2,000 inhabitants, while the largest, Stockholm stad, has almost 1 million. Since Sweden is a vast and sparsely populated country, there is a large difference between urban and rural municipalities. Urban regions are divided into wealthier central parts and poorer suburbs, while rural areas are differentiated along their economic activity. Demographic conditions vary, where rural areas face problems of depopulation, while urban centres often have growing population and uneven housing markets.
|
||||||
|
|
||||||
|
To understand how these dimensions interplay with each other, we build a space of Swedish municipalities and a space of Swedish regions. We use geometric data analysis to characterise municipalities and regions through demographic and socioeconomic indicators, including educational attainment, the number of graduates, and the number of adult students. We analyse the main dimensions of the spaces and explore possible geographical pattern and urban/rural divide in connection with the characterising variables. Constructing a space of municipalities and a space of regions allows us to put the two spaces in relation with each other, representing regions after the spread of municipalities in the space. We focus on the educational characterisation of these spaces and put them in relation with educational offer, attempting to answer three main sets of questions with a temporal perspective:
|
||||||
|
|
||||||
|
1. How are educational assets (in the form of level of education and institution types) distributed over the municipalities and regions and how does this change over time?
|
||||||
|
2. How is the educational offer spread over the municipalities and regions with regard to educational levels and types, public and private providers, and specialised institutions such as universities, university colleges, as well as folkhögskolor? How has this offer changed over time?
|
||||||
|
3. How are the distribution of educational assets in the space related to the educational offer? Are changes in the offer effecting the distribution?
|
||||||
Loading…
Add table
Reference in a new issue