I have a two vectors of different sizes. say
x <- rnorm(50, 2, 0.8)
y <- rnorm(35, 4, 0.5)
I want to create new vector z
of size 100 which contains sample of size 75 observation from x
and sample of size 25 from y
.
I thinking to use sample()
function of base package.
Try this:
x <- rnorm(50, 2, 0.8)
y <- rnorm(35, 4, 0.5)
z<-c(sample(x = x,size = 75,replace = T),sample(x = y,size = 25,replace = T))