How do I break/split the "strike" column into two columns, "kick_type" and "punch_type", and the "damage" column to "kick damage" and "punch damage"?
I have been at this for 3 hours now and I can't figure out how to split this. Note that I've used pivot_longer to come to this stage from untidy format where the strikes were all columns, so I've done other steps before but can't figure this out.
Reproducible code:
trial <- data.frame(fighter=c("Saenchai","Saenchai","Saenchai","Saenchai","Buakaw","Buakaw","Buakaw","Buakaw"),
strike=rep(c("roundhouse_kick","side_kick","lefthook_punch","uppercut_punch")),
damage=c(0.7,0.8,0.6,0.3,0.9,0.5,0.7,0.1))
It should look like this, but I don't know how to get there:
fighter kick_type kick_damage punch_type punch_damage
Saenchai roundhouse_kick 0.7 lefthook_punch 0.6
Saenchai side_kick 0.8 uppercut_punch 0.3