In R, how to generate 150 random numbers, using the numbers from 1 to 100 at least once?
library(tidyverse)
set.seed(123)
df <- tibble(Random_number = sample(x = 1:100,
size = 150,
replace = TRUE)) %>%
arrange(Random_number) %>%
view()
For example, the numbers 1, 2, 3, etc. never appeared. I know that this script is not good enough to make the numbers 1 through 100 always appear at least once, as I expect, but I have no idea how to actually write the script.
Aucun commentaire:
Enregistrer un commentaire