How about using map() instead of for() to handle the iterations. All of the results will be neatly available in a numeric vector after running, currently loaded in a variable called at in the sample code here:
suppressPackageStartupMessages(library(dplyr))
library(purrr)
at <- map_dbl(
1:381,
~{
#place your code here, replace "i", with ".x"
set.seed(.x)
mtcars %>%
sample_frac(0.2) %>%
summarise(max(mpg)) %>%
pull()
}
)
head(at)
#> [1] 21.4 24.4 27.3 30.4 21.0 21.5
Created on 2021-10-13 by the reprex package (v2.0.1)