Thanks in advance.
I have a vector of numbers which contain sections that are sequences which increase by a value of 1 followed by a gap in the data and then another sequence occurs, etc:

x<-c(1:3, 6: 7, 10:13)

From the vector I need to extract 2 items of information A) the first number in the sequence (e.g., 1, 6, 10) and B) how many observations were in each sequence section (e.g., 3, 2, 4).

v1   v2
1      3
6      2
10    4

It seems simple, but my R skills are still in their infancy so I very much appreciate the help.
Eric

--
Eric Vander Wal
Ph.D. Candidate
University of Saskatchewan, Department of Biology,
112 Science Place, Saskatoon, SK., S7N 5E2

"Pluralitas non est ponenda sine neccesitate"

______________________________________________
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