the three lines of R code below show a vector a1,b1 and "c1" which is the unique of fields a1. I want to display a data frame of two columns where I should get every element of c1 displayed the number of times equal to the length of elements in "a1", in one column, and the corresponding ID "b1" of that letter in another column. Simply, say a data frame with column "y" in which say letter "a" from "c1" will be represented 6 times back to back(length of string a1), then "b" 6 times, then c and so on. Also corresponding to a in other column, "1" 6 times, then "2" 6 times and so on. Please help and thanks.
a1 = c("a","b","c","d","a","b")
b1 = c(1,2,3,4,1,2)
c1 = unique(a1)
New Change
a1 = c("a","b","b","d","c","e","f","a","b","c","d")
b1 = c(1,1,1,2,3,2,3,1,1,3,2)
c1 = unique(a1)
See Question&Answers more detail:os