I have a dataframe with this structure:
dput(head(df, n=12))
structure(list(x1 = c("Total Nacional", "2022", "2021", "01 Araba/Álava",
"2022", "2021", "01001 Alegría-Dulantzi", "2022", "2021", "01002 Amurrio",
"2022", "2021"), saldo_total_2 = c(NA, 727005, 191094, NA, 3358,
1149, NA, -8, 38, NA, 68, 23), saldo_exterior_3 = c(NA, 727005,
191094, NA, 3583, 895, NA, -12, 1, NA, 99, 6), saldo_interior_4 = c(NA,
0, 0, NA, -225, 254, NA, 4, 37, NA, -31, 17), saldo_total_5 = c(NA,
338946, 94315, NA, 1601, 516, NA, 0, 13, NA, 42, 39), saldo_exterior_6 = c(NA,
338946, 94315, NA, 1644, 461, NA, -10, -4, NA, 46, 5), saldo_interior_7 = c(NA,
0, 0, NA, -43, 55, NA, 10, 17, NA, -4, 34), saldo_total_8 = c(NA,
388059, 96779, NA, 1757, 633, NA, -8, 25, NA, 26, -16), saldo_exterior_9 = c(NA,
388059, 96779, NA, 1939, 434, NA, -2, 5, NA, 53, 1), saldo_interior_10 = c(NA,
0, 0, NA, -182, 199, NA, -6, 20, NA, -27, -17)), row.names = c(NA,
-12L), class = c("tbl_df", "tbl", "data.frame"))
I want to filter data in column x1 to keep only 2022 observations and the name of the city with his code ("01001 Alegría-Dulantzi" and so on). The complete dataset are more than 24000 observations.