I am using R and have a data frame which has four columns. One of them is numeric, and another one has lists in each row:
column_1 column_2 column_3 column_4
a x 1 c("334", "538", "645", "763")
b y 2 c("762", "838")
c z 3 c("78", "85", "529", "797", "859")
d p 3 c("8", "75", "242", "766")
e q 4 c("85", "447", "529", "797", "859")
I want to order by data frame by column_3, and in case of a tie, in lexicographcal ascending order of column_4.
The example above is how my data frame looks after I sort my data frame using column_3 and column_4 as follows:
df <- df[order(df$column_3, df$column_4),]
However, my expected output is that row 2 should appear after row 3 since 78 is smaller than 762. Is it possible to do that?