[R] Identification of Turning Points in a Signal: Problem Fixed

2020-02-16 Thread Ogbos Okike
Dear Abby, I am very happy to report that the three lines you added have completely solved the problem. It is great to me. I have, for the past one week, approached the problem from various angles without much success. Thank you. Warmest regards Ogbos On Sun, Feb 16, 2020 at 9:30 PM Abby Spurdle

Re: [R] Identification of Turning Points in a Signal

2020-02-16 Thread Abby Spurdle
The data are different sizes. (As I suggested in my first post). The turnpoints function removes "ex-aequos". Replace the following: -- minima<-which(tp$pit & data$residual<= 20) - With: -- pits = rep (FALSE, nrow (data) ) pits [tp$pos] = tp$pits minima<-which(pits & data$residual<=

Re: [R] Identification of Turning Points in a Signal

2020-02-16 Thread Ogbos Okike
Dear Abby, I have run your code with the generated data. Thanks. The first script still runs OK while the second script had the same issues with your generated data (it could not identify the pits). I will try to attach the data, OULU05. The head and tail of the data are: year month day counts

Re: [R] Identification of Turning Points in a Signal

2020-02-16 Thread Ogbos Okike
Dear Abby, Thank you. I will look at your stimulated data and then run the code with it. But since I am dealing with real data and also have volumes of it, I would like to send my real data to you. The OULU05 is attached with dput function. It is labeled Ogbos_dput. I would be surprised if it

Re: [R] Identification of Turning Points in a Signal

2020-02-15 Thread Abby Spurdle
Note that your post does not contain a minimal reproducible example. I, and presumably most other readers, do not have the file "OULU05". Also, your first post referred to "% CR variation", however, your second post referred to "counts". I created a simple simulated data set: sim.data =

Re: [R] Identification of Turning Points in a Signal

2020-02-15 Thread Ogbos Okike
Dear Abby, Many thanks for your feedback on this. True, the structure of my question was not clear. I realized it later and have been thinking of a better way to re-posting. I am sorry about that. I will make extra efforts here to make it clearer. I have just a single data. I have tried to use d

Re: [R] Identification of Turning Points in a Signal

2020-02-15 Thread Abby Spurdle
Sorry no one replied sooner. Note that I find your question difficult to follow. It sounds like you have two datasets, each with different sizes. (e.g. Two data.frame objects, each with a different numbers of rows). Given that tp$pits is a logical index, trying to apply it to a vector (or data.f

[R] Identification of Turning Points in a Signal

2020-02-09 Thread Ogbos Okike
Dear Friends, Wishing you the best of the day. I have a data (Cosmic Ray) which exhibit flow patterns of a sine/cosine wave, i.e. decreasing/increasing and registering crests (points maximal increases) and troughs/pits (points maximal decreases). These turning points are of interest to me. With pa