Hi everyone,
I want to transpose only parts of a dataframe (population data) and this should be done repeatedly for the first rows 1:19, then 20:39, 40:59, and so on.
So my data frame looks roughly like this:
Community Age-cohort Year1 Year2 Year3 ....
1 0-3 numbers numbers
1 3-5
..
2 0-3
2 3-5
...
So the age cohorts and the years should be transposed, the positions of the community should not change. But every Community should be transposed alone and not the whole dataframe. I tried it with loops, but I do not know exactly how to do that. It is for some of you potentially obvious how to do that, but I am an absolute beginner in such tasks.
Thanks a lot for your help.