I have the following problem - I have one vector (variance_vec) which has variances for different materials in it (created by a tapply loop) which looks like:
Material A 0.8 Material B 0.21 . . .
Now I have another vector (mat_vec) which has random draws of materials in it, like:
Material A Material D Material B Materrial A . . .
I know want to assign the variance to every material in the mat_vec vector.
I tried it like:
#1 mat_vec_var<- variance_vec[[mat_vec]] #2 mat_vec_var<- adv_days[[c(mat_vec)]]
Both methods did not work for vectors.
How would I need to adjust my code to get a vector of variances for the randomly drawn materials? I know how I could do it in a loop but there are lots of observations in the vecotors so I would like to not use a loop for that.
Thanks for the help!