# [R] [Q] Newbie (continued.. at least I got R running allready :-)

Petr Pikal petr.pikal at precheza.cz
Mon Jun 21 14:27:20 CEST 2004

```Hi

On 18 Jun 2004 at 8:34, Gabor Grothendieck wrote:

>
>
> Check out ?turnpoints in the pastecs library.
>
> Try
>
>    example(turnpoints)
>    str(Nauplii.tp)
>
> to see the data structure you get back.  It identifies the peaks
> and pits and other associated information.

I am not sure if this is exactly what Jeroen really wants. As I went
through the picture (BTW it could be better if it had been slightly
smaller:), it seems to me that the "peaks" are very flat. If you look
at them they are like that

*****************************
*******                                                        **
***                                                                          *
*							       *
*                                                                                   *
^    ^            ^
1    2            3

and he/she wants to know where it starts and where it ends. What I
am not sure from the picture above is, if the peak starts at point 1,
2 or 3. Function rle can be of some help in that particular case, but
it depends what they want really to extract

based on data provided

vyber <- rle(co2)\$values>20 & rle(co2)\$lengths>5
# gives values co2 which are bigger than 20 and which are
simultaneously repeated more than five times

rle(co2)\$values[vyber]
[1] 35 36 37 32 35 35 34 32 35 36 35 35 36 37 35 37 37 35 36 37
35 35 37 30 29 36 37 37 32 25 36 38 39
# here are the values

> rle(co2)\$lengths[vyber]
[1]  6 14 29 16 50 18 16 20  7 29 31  6 10 18  7 28 52  6 10 22 34
6 10 13 11 10 10 23 10  7  8  6 47
# and here is their lengths

But it can be found that e.g. first three values are from the first
peak.

So I suppose they need to look more closely on what they really
want to know and than try to code it in R.

Cheers
Petr

>
> Date:   Fri, 18 Jun 2004 11:23:54 +0200
> From:   jeroen clarysse <jeroen.clarysse at easynet.be>
> To:   <r-help at stat.math.ethz.ch>
> Subject:   [R] [Q] Newbie (continued.. at least I got R running
>
>
> Hi all
>
> a week ago, I posted a newbie question in data smoothing &
> maximum-extraction with R. I got quite a lot of response, but I'm
> still kinda stuck with it...
>
> I'll restate the problem : i got a datafile with 2400 measuerements
> (every 250msec) of a CO2 measurement device, capturing the breath of a
> subject. I uploaded such a sample here :
>
> http://www.psy.kuleuven.ac.be/leerpsy/data.csv
>
> now I wish to figure out where each breath expiration ceiling takes
> place , as shown on this graph :
>
> http://www.psy.kuleuven.ac.be/leerpsy/graph.bmp
>
>
> I'm kinda stuck on how to get this running in R.
>
> I really hope someone can help me out. If you guys can get me running,
> I promise to promote R as often as I can here on our faculty (which
> still uses Statistica for almost everything)
>
> thanks a million in advance !
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help