I have a simple table with paragraph numeration:
> table <- data.frame(id=c(1,2,3,4,5,6,7,8,9), paragraph=c("1.1.1.1","1","2","1.1","100","1.2","10","1.1.1","1.1.2"))
> print(table)
id paragraph
1 1.1.1.1
2 1
3 2
4 1.1
5 100
6 1.2
7 10
8 1.1.1
9 1.1.2
10 1.10
I would like to sort it by this way:
id paragraph
2 1
4 1.1
8 1.1.1
1 1.1.1.1
9 1.1.2
6 1.2
10 1.10
3 2
7 10
5 100
The issue for me (I could probably split them by .
to the data.frame
and then apply multiple column ordering), is that I don't know how many dots could be in the output – the amount could vary from time to time.