I have the vector X
and I would like to generate a data.frame
of 6 integer samples of size 4. In other words, I would like to have a data.frame
of 6 * 4 dimension. I tried the following the following but its throwing out lenght argument error.
set.seed(123)
X <- c(4,10,15,100,50,31,311,225,85,91)
S <- replicate(X, sample.int(n = 6, size = 4))
>Solution :
We may need
replicate(4, sample(X, size = 6))
Or
replicate(6, sample(X, size = 4))