Hi,
I have a data of schools and student names and number of students in that school. Against each student, i need to create a code as shown in the dataframe data1. So in first school, there are 3 students then S1C1 to S1C3 will be created and so on.
Is this possible to do?
library(tidyverse)
data<-tibble::tribble(
~selectedschoolid, ~child_name_1, ~number,
"SCH251-GMKPS NAVALURU-29090102801", "Kushi B Tadas", 3L,
"SCH251-GMKPS NAVALURU-29090102801", "Kavya manjunath sarapur", 3L,
"SCH251-GMKPS NAVALURU-29090102801", "Gouri Hengannavar", 3L,
"SCH294-GMPS BYAHATTI-29090700904", "Manikanta guranavar", 4L,
"SCH294-GMPS BYAHATTI-29090700904", "Suprithgouda N Patil", 4L,
"SCH294-GMPS BYAHATTI-29090700904", "Darshan jainar", 4L,
"SCH294-GMPS BYAHATTI-29090700904", "Kiran B Nayakanur", 4L
)
data1<-tibble::tribble(
~selectedschoolid, ~child_name_1, ~number, ~std_code,
"SCH251-GMKPS NAVALURU-29090102801", "Kushi B Tadas", 3L, "S1C1",
"SCH251-GMKPS NAVALURU-29090102801", "Kavya manjunath sarapur", 3L, "S1C2",
"SCH251-GMKPS NAVALURU-29090102801", "Gouri Hengannavar", 3L, "S1C3",
"SCH294-GMPS BYAHATTI-29090700904", "Manikanta guranavar", 4L, "S2C1",
"SCH294-GMPS BYAHATTI-29090700904", "Suprithgouda N Patil", 4L, "S2C2",
"SCH294-GMPS BYAHATTI-29090700904", "Darshan jainar", 4L, "S2C3",
"SCH294-GMPS BYAHATTI-29090700904", "Kiran B Nayakanur", 4L, "S2C4"
)
Created on 2022-07-12 by the reprex package (v2.0.1)