I have a dataframe with 3 columns: A, B, C In each column there is values going from 0 to 10 I want to figure out how often each possible size orders occurs e.g.:
A>B>C #?
A>C>B #?
B>A>C #?
B>C>A #?
C>A>B #?
C>B>A #?
When dealing with only two columns this is rather easy and can be done as follows:
df$c <- as.numeric(df$a > df$b)
I was wondering whether there is something simlar for 3 or more columns (i.e. a formula that asigns n! values; in the case of n being 3: a 1,2,3,4,5,6 value based on the order observed)