I have a data frame which I want to sort. However, the column I want to sort by is a combination of a letter and a number.
df <- data.frame(a = sample(paste0("C", 1:20)), b = sample(LETTERS[1:26],20))
df[order(df$a),]
Ordering likes this gives me C1, C10, C11, ..., C19, C2, C20, ...
What do I need to change in order to sort the column like this: C1, C2, C3, ...
Thank you. :-)