I want to take random samples from multiple vectors of different length using vector lengths as some sort of weight, such that more samples are drawn from vectors of larger sizes when compared to smaller ones (proportional sampling of sorts).
To illustrate my point please consider this:
# Generating 100 different individuals
vec1 <- rep( letters , length.out = 100 )
vec2 <- c(1:100)
# Join two above vectors
students <- paste( vec1 , vec2 , sep="" )
The above produces a giant vector of 100 students. Now I am trying to generate 10 random vectors from which the final sampling has to take place.
# Creating 10 vectors of different sizes
a <- split( students , sample(10, 100 , repl = TRUE) )
vec1 <- a$`1`
vec2 <- a$`2`
vec3 <- a$`3`
vec4 <- a$`4`
vec5 <- a$`5`
vec6 <- a$`6`
vec7 <- a$`7`
vec8 <- a$`8`
vec9 <- a$`9`
vec10 <- a$`10`
So, now I have 10 vectors (vec1...vec10) of varying sizes. My goal is to get a final vector with a total of 50 random samples from all the vectors, such that when sampling is done it would be wrt vector length i.e., proportional sampling.
Is something like this possible?
Apologies if this has been asked before!