I am having problems with the pivot family of functions which don't seem to work. I have updated tidyr to version 1.0.2 have rlang version 0.4.5. I also re-installed R 4.0.0 so don't understand why this is not working. Here I am trying to collect metadata for the transformation I want to perform.
LomaWideSmall %>%
tidyr::pivot_longer_spec(
cols = starts_with("fight"),
names_to = "fight_no",
values_to = "result",
names_prefix = "fight_"
)
Error in tidyr::pivot_longer_spec(., cols = starts_with("fight"), names_to = "fight_no", :
unused arguments (cols = starts_with("fight"), names_to = "fight_no", values_to = "result", names_prefix = "fight_")
Can anyone help?
The dataframe looks like this:
opponent | date | fight_1 | fight_2 | fight_3 | fight_4 | fight_5 | fight_6 |
---|---|---|---|---|---|---|---|
JosĂ© RamĂrez | 12/10/2013 | Win | NA | NA | NA | NA | NA |
Orlando Salido | 01/03/2014 | NA | Loss | NA | NA | NA | NA |
Gary Russell Jr. | 21/06/2014 | NA | NA | Win | NA | NA | NA |
Chonlatarn Piriyapinyo | 22/11/2014 | NA | NA | NA | Win | NA | NA |
Gamalier RodrĂguez | 02/05/2015 | NA | NA | NA | NA | Win | NA |
Romulo Koasicha | 07/11/2015 | NA | NA | NA | NA | NA | Win |