This might help:  if x is a vector of the race days then max(diff(sort(x))) finds the biggest gap between consecutive values.

>>> 

From: "Jana.K" <borjana.kragic@gmail.com>
To:<r-help@r-project.org>
Date: 7/Oct/2011 4:47a
Subject: [R] Urgent help needed for honours project - breaks between races in one year

Hi to anyone who is willing to help,

I have a csv. file which has 1999 horses as the rows and the age(in years)
of the horse at each race as columns. Ive read this file into R and called
it 'horses'.
Im trying to find the longest break between each race in the horse's first
year of racing. I already have a numeric called 'age.first' which is the age
at which each horse had its first race. I understand if i want to look at
the breaks a year from the first race i have to add +1. But i am not sure
how to write the code into R. Can anyone help me get the longest break in
the first year of racing for each horse?

Jana.

--
View this message in context: http://r.789695.n4.nabble.com/Urgent-help-needed-for-honours-project-breaks-between-races-in-one-year-tp3878187p3878187.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.

	[[alternative HTML version deleted]]

