[R] Generate a sequence of random integer values

Bill Vinyard wcvinyard at earthlink.net
Fri May 28 03:07:14 CEST 2004


help(sample)

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Brian Davenhall
Sent: Thursday, May 27, 2004 20:54
To: r-help at stat.math.ethz.ch
Subject: [R] Generate a sequence of random integer values


I'm trying to generate a sequence of random integer values.  I've tried to
combine the random (r) and the sequence (seq) functions but this approach
does not work.  For example, if I use the following command:

> a <- seq(1:100)
> a
  [1]   1   2   3   4   5   6   7   8   9  etc.

This is a good start, but what I really want is something that would look
like this instead

 [1]  3 96 45 67 8 24 99 63 8, etc.

where the integer numbers between 1 and 100 are randomly chosen.

Any help would be great, I've found workarounds in other stat packages, but
would prefer to do this in R.

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list