I was wondering how I could generate 1000 integers from 1 to 1000, one at a time in R. Making this a function, this means on the first run 1, on the second run 2, on the third run 3, ...?
I have tried the following in R with no success:
gen = function(n){
sample(1:n, 1, replace = FALSE)
}
gen(1000)
Aucun commentaire:
Enregistrer un commentaire