Dear Dale,
Try this:
set.seed(555)
x <- sample(1:365, 10, replace=TRUE)
x <- sort(x)
diff(x)
HTH,
Jorge
On Thu, Jan 22, 2009 at 10:07 AM, Dale Steele wrote:
> I'm stuck on how best to of find the distance between ordered integers
> (presented below as a birthday problem). Given the vector x,
I'm stuck on how best to of find the distance between ordered integers
(presented below as a birthday problem). Given the vector x, how do I
most efficiently generate the vector x[i+1] - x[i]? Thanks. --Dale
For example...
set.seed(555)
x <- sample(1:365, 10, replace=TRUE)
x <- sort(x)
x
2 matches
Mail list logo