I wrote the following code and got the error: number of items to replace is not a multiple of replacement length at code line:
X_after[count, ] = c(censN1, cen
Your problem lies in the fact that
sub_samples = n_samples/3
is not a whole number.
When you create a sample of fractional size it creates a sample of floor(size)
length(rlnorm(1.5,1,1))
## [1] 1
Thus, when you recombine your data
length( c(censN1, censN2, censN3))
does not (necessarily) equal n_sample
.
Thus, you need a method for dealing with numbers of samples that are not divisible by 3.