0

Suppose I have the following data

df <- data.frame(v1 = c("a", "z"), v2 = c("y", "b"), v3 = c("m", "n"))

v1 v2 v3
 a  y  m  
 z  b  n

What is the fastest way to create 3 new columns with ordered data like the following?

v1 v2 v3 alphabetical_1 alphabetical_2 alphabetical_3
 a  y  m              a              m              y
 z  b  n              b              n              z

I have thousands of rows of data like this.

Manjuboyz
  • 6,978
  • 3
  • 21
  • 43
johnny
  • 571
  • 4
  • 14

0 Answers0