I am using a data frame in R where col4 its supposed to be less than col5, but sometimes that does not happen.
Is there anyway I could shift the value from col4 to col5, and viceversa without having to use a forloop, since they are quite time expensive in R.
I.e., if for a given row col4 = 100, and col5=10, I’d like to shift them, and col4 should become 10, and col5 should become 100.
Advise welcome, thanks in advance!
Assuming that your data frame is named d: