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       x[i+1]-x[i]
---    ---------------
14      
14      0
75      61
136     61
197     61
236     39
253     17
310     57
323     13
355     32

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to