I'm looking for a way to transform this data
df <- tribble(
~lp, ~`2017`, ~`2018`, ~`2019`, ~`2020`, ~Bank,
1, 3.6, 11.3, 9.7, 12.5, "SANPL",
2, 5.5, 3.6, 6.6, 4.6, "MBANK",
3, 6.5, 14.4, 11.6, 13.7, "INGBSK",
4, 7.1, 11.1, 15.7, 12.7, "PKOBP",
5, 7.7, 9.7, 13, 12.1, "PEKAO",
6, 14, 7.2, 6.4, 5, "MILLENIUM",
7, 7.8, 16, 3.8, 13.1, "ALIOR",
8, 3.8, 9.8, 7.2, 8.7, "HANDLOWY"
)
into this
speciffically by apply functions. Is there a way just to transform this data and not use any method to amend it?
You could do: