Suppose I have a data.frame df
library(tidyverse)
df<-data.frame(x=paste0("S", 1:15), y=letters[1:15], stringsAsFactors=F)%>%
arrange(x)
x y
1 S1 a
2 S10 j
3 S11 k
4 S12 l
5 S13 m
6 S14 n
7 S15 o
8 S2 b
9 S3 c
10 S4 d
11 S5 e
12 S6 f
13 S7 g
14 S8 h
15 S9 i
How can I arrange the x
as an output like:
x y
1 S1 a
2 S2 b
3 S3 c
4 S4 d
5 S5 e
6 S6 f
7 S7 g
8 S8 h
9 S9 i
10 S10 j
11 S11 k
12 S12 l
13 S13 m
14 S14 n
15 S15 o