[R] sequentially process a list

From: Robert <jsubei_at_yahoo.fr>
Date: Mon, 21 May 2007 09:39:43 +0000 (GMT)


Hi dear R users,

I'm a R beginner and I have a basic question about sequential treatments of lists.

I have a time based (i.e. events are consecutive) list of values of a biological property.

Like :

time value

1        5
2        10  
3      7
4      10
5      19
6      21
7      20
8      18
9      10
10      7
11      8
12      12
13      17
14      19
15      24
16      18
17      15
18      10
19      9

[...]

And I have to define a threshold and to attach each event to his group, i.e. values upper the threshold.

Like, for a threshold value of 17

time value group

1        5       NA
2        10      NA
3      7      NA
4      10      NA
5      19      1
6      21      1
7      20      1
8      18      1
9      10      NA
10      7      NA
11      8      NA
12      12      NA
13      17      2
14      19      2
15      24      2
16      18      2
17      15      NA
18      10      NA
19      9      NA

[...]

The only solution that I have found is to do a sequentially read and write : for(i in 1:length(my_events_list))
{

    [...]
}

But I very slow. Do you have another ideas ?

And after I need to extract maximum values for each group Like :

group        max_value
1            21
2            24

[...]

and for each event which is part of a group to know if is't a ascending phase or no.

Yes, lot of questions !! Sorry, but I think that the solution may be unique.

In advance, thank you a lot

regards

JS




R-help_at_stat.math.ethz.ch 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. Received on Mon 21 May 2007 - 15:33:25 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 21 May 2007 - 17:31:14 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.