Been trying to find the answer to this question and haven't been able to. Say I have the dataframe,
DF <- data.frame (x=c("2,A","1,A","1,C", "1,B"), y = c(1,2,2,1))
yielding a Dataframe with two columns, the first of which has a number and a letter. How can I sort DF according to the number part of each of its rows? And then, add to it another column only with the letter. The objective is to obtain,
x y z
1 1,A 2 A
2 2,A 1 A
3 1,B 1 B
4 1,C 2 C
Cheers