I was trying to use alpha conversion to col argument in plot function. How do I do that without having to write col=alpha(each_color,.5) for each_color.
Is there a way to vectorize that?
Here is reproducible example:
set.seed(10)
mydata <- rnorm(100)
mycol <-c("#FDF6E3", "#B3E2CD", "#FDCDAC", "#CBD5E8", "#F4CAE4", "#E6F5C9", "#FFF2AE", "#F1E2CC", "#CCCCCC")
par(bg='gray30')
plot(mydata,col=mycol,pch=19,cex=3)
mycol_alpha <- paste0('alpha(\'',mycol,'\',.5)')
par(bg='white')
Is there a way to apply mycol_alpha to plot function directly or by some other way? 
update:
This one has the solution. My mistake, I thought the alpha function is in base R.
We need library(scales)
Solution:
set.seed(10)
mydata <- rnorm(100)
mycol <-c("#FDF6E3", "#B3E2CD", "#FDCDAC", "#CBD5E8", "#F4CAE4", "#E6F5C9", "#FFF2AE", "#F1E2CC", "#CCCCCC")
par(bg='gray30')
plot(mydata,col=scales::alpha(mycol,.5),pch=19,cex=3)
 
     
    