& gtmore.colors & lt-c ("red", "yellow", "blue", "green", "meganta", "cyan")
Then assign the vector 1, 2, 3, 2, 3, 4, 3, 4, 5, 3, 4, 5, 6 to the vector ind.
& gtind & lt-rep( 1:3,4)+rep(0:3,rep(3,4))
finally
& gt more colors [ind]
[1] "red" "yellow" "blue" "yellow" "blue" "green" "blue" "green" "magneta" "green" "magenta" "cyan"