With a dataframe like this:
structure(list(Mun = c("Argan", "Balb", "Barj", "Bemb", "Benz"
), PS_col2 = c(342L, 27L, 10L, 235L, 0L), PS_col3 = c(6010L,
1250L, 0L, 475L, 0L), PS_col4 = c(5L, 1L, 3L, 0L, 0L), PP_col2 = c(87L,
180L, 15L, 771L, 11L), PP_col3 = c(1528L, 8333L, 0L, 1560L, 258L
), PP_col4 = c(1L, 6L, 2L, 2L, 0L), CBR_col2 = c(135L, 0L, 0L,
59L, 231L), CBR_col3 = c(2372L, 0L, 0L, 119L, 5422L), CBR_col4 = c(1L,
0L, 0L, 0L, 4L), VO_col2 = c(0L, 0L, 0L, 113L, 184L), VO_col3 = c(0L,
0L, 0L, 228L, 4319L), VO_col4 = c(0L, 0L, 0L, 0L, 3L), XBEMB_col2 = c(0L,
0L, 0L, 2292L, 0L), XBEMB_col3 = c(0L, 0L, 0L, 4637L, 0L), XBEMB_col4 = c(0L,
0L, 0L, 7L, 0L), BC_col2 = c(0L, 0L, 0L, 1107L, 0L), BC_col3 = c(0L,
0L, 0L, 2239L, 0L), BC_col4 = c(0L, 0L, 0L, 3L, 0L), UP_col2 = c(0L,
0L, 0L, 336L, 0L), UP_col3 = c(0L, 0L, 0L, 679L, 0L), UP_col4 = c(0L,
0L, 0L, 1L, 0L)), row.names = c(NA, -5L), class = c("tbl_df",
"tbl", "data.frame"))
It's possible to merge two or more columns (like XBEMB_col2, BC_col2, UP_col2) in a new column with a new name? And same with other columns /XBEMB_col3, BC_col3, UP_col3/ also with new column and new name.