Java Mailing List Archive

http://www.r-help.com/

Home » Home (12/2007) » R Help for Statistical Computing »

[R] sequentially process a list

Norbert

2007-05-21

Replies:

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@(protected)
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.
©2008 r-help.com - Jax Systems, LLC, U.S.A.