Hi,
I have a data with student names. I want to create unique IDs for them with condition. The ID should have 3 capital alphabets (A,B,C, etc.) with 3 numbers. Hence the ID will have 6 characters like say, FGY675 as given in the data frame "data_id" below.
Is this possible to create?
library(tidyverse)
data<-tibble::tribble(
~student_name, ~teacher,
"Ravi", "Jaya",
"Gandhi", "Jaya",
"Nehru", "Jaya",
"Giri", "Jaya",
"Nivin", "Jaya",
"Nithin", "Shiva",
"Mithun", "Shiva",
"Vinayak", "Shiva",
"Girirsh", "Shiva",
"Akshay", "Shiva"
)
data_id<-tibble::tribble(
~student_name, ~teacher, ~random_id,
"Ravi", "Jaya", "BGH142",
"Gandhi", "Jaya", "GHT675",
"Nehru", "Jaya", "JUS098",
"Giri", "Jaya", "NJS767",
"Nivin", "Jaya", "POI999",
"Nithin", "Shiva", "MIU567",
"Mithun", "Shiva", "NUY144",
"Vinayak", "Shiva", "MRE235",
"Girirsh", "Shiva", "MMS258",
"Akshay", "Shiva", "MAE257"
)
Created on 2022-08-10 by the reprex package (v2.0.1)