Description Usage Arguments Value Examples

Provided a vector of any class, the function will return a set of colors with the same length and order as the input vector. A random seed is used and will be printed in order to save desireable color palettes. Color transparency can also be modified.

1 | ```
as.color(x, alpha, seed)
``` |

`x` |
A vector of any class and length. |

`alpha` |
A numeric value between 0 and 1 to control color transparency. Defualt is value is 0.5. |

`seed` |
A value to seed the random colors. If not provided, a new palette of random colors will be generated with each call to the function. |

output a vector of hexidecimal colors of length x will be returned.

1 2 3 4 5 6 7 8 9 | ```
#simple data frame with factors
n <- 100
f <- 5
x <- sort(rnorm(n, mean = 0, sd = 50)) + rnorm(n, mean = 0, sd = 30)
fact <- rep(letters[1:5], each=n/f)
#call to as.color, with char vector
colz <- as.color(fact, alpha = 1)
plotx <- as.integer(as.factor(fact))
plot( jitter(plotx), x, col=colz, pch=19)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.