그냥 약간의 적응을 할 것입니다. 당신은 정말 print(h)
에
set.seed(8632) # make the results reproducible
i <- sapply(1:3, function(x){
e = runif(1, 5, 10)
f = round(e)
g = sample(test, f, TRUE)
h = paste(g, collapse = "")
print(h)
h
})
i
#[1] "CACDAABCC" "ADDAACA" "ACCDAACAB"
가 필요하십니까?
EDIT.
방금 테스트 해본 결과 다음과 같은 단순화가 똑같은 결과를 제공합니다.
set.seed(8632) # make the results reproducible
j <- sapply(1:3, function(x){
f <- sample(5:10, 1) # this is equivalent to your original code
g = sample(test, f, TRUE)
h = paste(g, collapse = "")
print(h)
h
})
j
#[1] "CACDAABCC" "ADDAACA" "ACCDAACAB"
identical(i, j)
#[1] TRUE
을,'H [내가 ] = paste (g, collapse = "")'. – patL