[R] Constant value in an interval

Katschke, Adrian R akatschk at iupui.edu
Thu Jun 18 20:40:27 CEST 2009


I am calling on the R-help crew once again. The CD4Per for each subject should be the same for each subject based on a 90 day window either side of the known value. For example, ID 2931 should have a CD4Per of 36 at 0, 34, and 62 DaysEnrolled. Any ideas how to do this without a loop? 

     ID     DaysEnrolled CD4Per
10  1436            0     NA
11  2931            0     NA
12  2931           34     36
13  2931           62     NA
14  2931          125     NA
15  2931          181     NA
16  2931          273     NA
277 3802            0     NA
278 3802           28     NA
279 3802           54     NA
280 3802           69     NA
281 3802           96     NA
282 3802          110     NA
283 3802          138     27
284 3802          141     NA
285 3802          166     NA
286 3802          194     NA
287 3802          222     NA
288 3802          223     NA
289 3802          267     NA
290 3802          288     NA
291 3802          327     35
292 3802          354     NA
293 3802          397     NA
294 3802          424     NA
295 3802          448     NA
296 3802          466     NA
297 3802          508     NA
298 3802          516     NA
299 3802          536     NA
300 3802          566     NA
301 3802          609     NA
302 3802          662     NA
303 3802          729     NA
304 3802          764     NA
305 3802          785     NA
306 3802          813     NA
307 3802          841     NA
308 3802          869     NA
309 3802          897     37
310 3802          974     NA
311 3802         1002     NA
312 3802         1030     NA
379 3806            0     NA
380 3806           22     15
381 3806           30     NA
382 3806           43     NA
383 3806           50     NA
384 3806           57     NA
385 3806           64     NA

Adrian Katschke
Biostatistician
IU Department of Medicine
Division of Biostatistics
akatschk at iupui.edu
317-278-6665




More information about the R-help mailing list