[R] long format - find age when another variable is first 'high'

ONKELINX, Thierry Thierry.ONKELINX at inbo.be
Mon May 25 14:57:36 CEST 2009

Dear David,

You would speed up things is you first create a subset were all values
of ldlc is >= 130. Then you only have to find the lowest age for each
child in this subset.



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
tel. + 32 54/436 185
Thierry.Onkelinx at inbo.be

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
Namens David Freedman
Verzonden: maandag 25 mei 2009 14:45
Aan: r-help at r-project.org
Onderwerp: [R] long format - find age when another variable is first

Dear R, 

I've got a data frame with children examined multiple times and at
various ages.  I'm trying to find the first age at which another
(LDL-Cholesterol) is >= 130 mg/dL; for some children, this may never
I can do this with transformBy and ddply, but with 10,000 different
children, these functions take some time on my PCs - is there a faster
way to do this in R?  My code on a small dataset follows.  

Thanks very much, David Freedman

View this message in context:
Sent from the R help mailing list archive at Nabble.com.

R-help at r-project.org mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message 
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.

More information about the R-help mailing list