How do I change this table from wide to long format in R? I have tried a few different libraries but can't seem to get it.
Region A B C Region A B C Region A B C
1 SS 45 98 89 KK 87 NA 25 MM 88 NA 59
2 SS 22 NA 77 KK 45 78 88 MM NA 72 35
I have tried using reshape(df5, idvar=" " , timevar='' , direction="")
but can't fix my data.
I want this data as-
Region A B C
1 SS 45 98 89
2 SS 22 NA 77
3 KK 87 NA 25
4 KK 45 78 88
5 MM 88 NA 59
6 MM NA 72 35
It would be great if I get the answer using reshape
.