Skip to content

Instantly share code, notes, and snippets.

@kalebr
Created May 20, 2014 18:25
Show Gist options
  • Save kalebr/bfe4e75a1abd9b043612 to your computer and use it in GitHub Desktop.
Save kalebr/bfe4e75a1abd9b043612 to your computer and use it in GitHub Desktop.
select colors using a vector as indicies
n = 5
g = sample(1:n, 20, replace=T)
c = sapply(g, FUN=function(x) rainbow( n )[[x]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment