How do I solve the error "can't select within an unnamed vector" when using pivot_longer()?

I am trying to recreate the code written by andresrcs here, but with my own data.

Am I correct in thinking that the reason why my code failed is that I needed to use the column names as formals, but the pSupport and pOppose variables are just containers for the column data, not the names of the columns?